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;
}
}

Complete The Pattern #1的更多相关文章

  1. Complete The Pattern #2

    Complete The Pattern #2 Description: Task: You have to write a function pattern which creates the fo ...

  2. Complete The Pattern #6 - Odd Ladder

    Complete The Pattern #6 - Odd Ladder Task: You have to write a function pattern which creates the fo ...

  3. 如何正确地使用RecyclerView.ListAdapter

    默认是在一个fragment中实现RecyclerView. private inner class CrimeAdapter() : ListAdapter<Crime, CrimeHolde ...

  4. Event Sourcing Pattern 事件源模式

    Use an append-only store to record the full series of events that describe actions taken on data in ...

  5. Compute Resource Consolidation Pattern 计算资源整合模式

    Consolidate multiple tasks or operations into a single computational unit. This pattern can increase ...

  6. Competing Consumers Pattern (竞争消费者模式)

    Enable multiple concurrent consumers to process messages received on the same messaging channel. Thi ...

  7. Compensating Transaction Pattern(事务修正模式)

    Undo the work performed by a series of steps, which together define an eventually consistent operati ...

  8. Circuit Breaker Pattern(断路器模式)

    Handle faults that may take a variable amount of time to rectify when connecting to a remote service ...

  9. [转]Design Pattern Interview Questions - Part 4

    Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, COR Pattern, Proxy Pattern, te ...

随机推荐

  1. Cookie和Seesion的区别

    一.Cookie对象: 1.Cookie是由网络服务器发送出来,存在在浏览器上,它是个存储在浏览器目录中的文本文件.当浏览该cookie对应的站点时,cookie作为http头部文件的一部分在浏览器和 ...

  2. pdf转chm的实现方法

    相比pdf, CHM电子书在Windows系统下不需要安装额外的浏览器即可进行阅读,其内容是基于浏览器的风格,更容易被用户所接受.而且, 具有更强大的功能配置,比如可提供强大的全文搜索.索引.书签等的 ...

  3. linux内核编译,内核参数修改

    核心(kernel):/boot/vmlinuz-version version 带发行包版本,本地版本内核模块(kernel object): /lib/modules/version/ 内核设计: ...

  4. sublime 经验总结 主题有 less2css

    1. 安装“包控制”模块 操作步骤见该网站:https://sublime.wbond.net/installation#Simple sublime2的代码如下: import urllib2,os ...

  5. 微软职位内部推荐-Sr Development Lead-OSG-IPX

    微软近期Open的职位: Job Summary:Be part of Microsoft's strategy to deliver a great input experience across ...

  6. IOS调用相机和相册时无法显示中文

    调用系统相册.相机发现是英文的系统相簿界面后标题显示“photos”,但是手机语言已经设置显示中文 需要在info.plist做如下设置 info.plist里面添加 Localizedresourc ...

  7. linux学习笔记(1)-文件处理相关命令

    列出文件和目录 ls (list) #ls 在终端里键入ls,并回车,就会列出当前目录的文件和目录,但是不包括隐藏文件和目录 #ls -a 列出当前目录的所有文件 #ls -al 列出当前目的所有文件 ...

  8. Object调用静态方法

    谁说空指针不能调用方法 public class Foo { public static void bar() { System.out.println("bar"); } pub ...

  9. HTML标签<b>与<strong>以及<i>与<em>的区别

    在一般情况下,<b>和<strong>标签的显示效果一样,<i>和<em>标签的显示效果一样.那么它们的区别在哪呢?我们应该使用哪种标签呢? 在w3sc ...

  10. 1027: [JSOI2007]合金 - BZOJ

    Description 某公司加工一种由铁.铝.锡组成的合金.他们的工作很简单.首先进口一些铁铝锡合金原材料,不同种类的原材料中铁铝锡的比重不同.然后,将每种原材料取出一定量,经过融解.混合,得到新的 ...