Complete The Pattern #1

Task:

You have to write a function pattern which creates the following pattern upto n number of rows.

  • If the Argument is 0 or a Negative Integer then it should return ""

Pattern:

1
22
333
....
.....
nnnnnn

Note: There are no spaces in the pattern

Hint: Use \n in string to jump to next line

 

无形装逼最为致命,居然喜欢上用Linq了

using System;
using System.Linq; public class Kata
{
public string Pattern(int n)
{
// Happy Coding ^_^
string result = string.Empty;
if (n > )
{
result = string.Join(Environment.NewLine, Enumerable.Range(, n).Select(item => string.Join(string.Empty, Enumerable.Repeat(item, item))));
}
return result;
}
}

最新文章

  1. spring boot 添加拦截器
  2. maven核心,pom.xml详解(转)
  3. 向 Git 服务器添加 SSH 公钥
  4. Apache Spark技术实战之4 -- 利用Spark将json文件导入Cassandra
  5. SqlSever基础 Upper函数 返回字符串的大写形式
  6. Nginx安装(zhuan)
  7. PAT1099
  8. [Linux]学习笔记(4)-su及passwd的用法介绍
  9. pod setup 报CocoaPods was not able to update the `master` repo 错误解决办法
  10. Android 拨号器的简单实现
  11. 实现动态的XML文件读写操作
  12. windows 下编译php扩展库pecl里的扩展memcache
  13. [Usaco2015 Jan]Grass Cownoisseur Tarjan缩点+SPFA
  14. 用node搭建简单的静态资源管理器
  15. Python基础知识拾遗
  16. linux僵尸进程
  17. Keras官方中文文档:常见问题与解答
  18. js 学习之路6: if...else...条件语句的使用
  19. Doctrine2-基础概念
  20. Leetcode 存在重复元素 (219,220)

热门文章

  1. C#委托的异步调用
  2. html 模板 swig 预编译插件 grunt-swig-precompile
  3. apache配置网站目录的读写权限
  4. vsftpd本地用户登录密码错误
  5. 1.JSP 简介及工作原理
  6. CSS 将按钮转成超链接样式
  7. cocos2dx之Lua调用C++
  8. 【BZOJ 1563】 [NOI2009]诗人小G
  9. python学习笔记7(使用字符串)
  10. 使用NodeJS+AngularJS+MongoDB实现一个Web数据扒取-分析-展示的系统