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. Centos 6.5编译安装Nginx+php+Mysql

    说明: 操作系统:CentOS 6.5 64位 准备篇: 一.配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 二.配置防火墙,开启80端口.3306端口 vi /etc/sysconf ...

  2. 将Ecshop后台fckeditor升级更改为kindeditor 4.1.10编辑器

    ecshop在win8部分电脑上,不管用任何浏览器,都打不开,即使升级到最新版本都不行,问题应该吃在fckeditor兼容上.fckeditor 很久未升级,换掉该编辑器是最佳方法 第一步:下载kin ...

  3. uniquery 配合 mssql 自带存储过程实现分页

    --使用系统存储过程实现的通用分页存储过程 -- 此过程原作者,应该是:邹健老前辈 CREATE PROC sp_PageView @sql ntext, --要执行的sql语句 , --要显示的页码 ...

  4. RTC搭建android下三层应用程序访问服务器MsSql-服务器端

    前几天通过Ro搭建webservice,然后在android下调用,虽然已近成功,但是返回的数据库里的中文有乱码一直未得到解决!rtc6.23版本,已经支持xe5,也支持fmx的android下开发, ...

  5. 云主机上搭建squid3代理服务器

    目录 目录 具体流程 修改配置文件 问题 维基整理 代理服务器 Squid (软件) SOCKS SOCKS代理 参考:http://raysmond.com/node/79 具体流程 在服务器上安装 ...

  6. 因程序问题引起的服务器CPU负荷一直保持在90%以上

    昨天早上刚到办公室,就接到客户的电话说其某台小型机的CPU负荷一直保持在90以上,告警短信发个不停,一直没有间断过.该服务器是一台IBM的小型机,性能应该还是不错的,出现这样的情况确实不太正常.登陆上 ...

  7. Redis之七种武器

    长生剑.孔雀翎.碧玉刀.多情环.离别钩.霸王枪.拳头是古龙笔下的七种武器,而本文打算将Redis的几种使用方式 Strings.Hashs.Lists.Sets.Sorted Sets.Pub/Sub ...

  8. poi导出到excel步骤分析

    在没用过poi之前感觉poi是很高大上的样子, 项目中用了发现poi的代码重复性很高类似于jdbc的模板代码, 项目中如果大量使用最好封装起来; 总结一下归结为6步 1 打开或新创建一个工作薄(使用H ...

  9. js 人工获取年月日

    var date = new Date(); var months = new Array("01", "02", "03", " ...

  10. js数组反转

    var _li = test.getElementsByTagName("li"), arrayObj = [].slice.apply(_li),//_li用apply调用sli ...