Complete The Pattern #1
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的更多相关文章
- Complete The Pattern #2
Complete The Pattern #2 Description: Task: You have to write a function pattern which creates the fo ...
- Complete The Pattern #6 - Odd Ladder
Complete The Pattern #6 - Odd Ladder Task: You have to write a function pattern which creates the fo ...
- 如何正确地使用RecyclerView.ListAdapter
默认是在一个fragment中实现RecyclerView. private inner class CrimeAdapter() : ListAdapter<Crime, CrimeHolde ...
- Event Sourcing Pattern 事件源模式
Use an append-only store to record the full series of events that describe actions taken on data in ...
- Compute Resource Consolidation Pattern 计算资源整合模式
Consolidate multiple tasks or operations into a single computational unit. This pattern can increase ...
- Competing Consumers Pattern (竞争消费者模式)
Enable multiple concurrent consumers to process messages received on the same messaging channel. Thi ...
- Compensating Transaction Pattern(事务修正模式)
Undo the work performed by a series of steps, which together define an eventually consistent operati ...
- Circuit Breaker Pattern(断路器模式)
Handle faults that may take a variable amount of time to rectify when connecting to a remote service ...
- [转]Design Pattern Interview Questions - Part 4
Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, COR Pattern, Proxy Pattern, te ...
随机推荐
- CSS3中的变形处理(transform)属性
在CSS3中,可以利用transform功能来实现文字或图像的旋转.扭曲.缩放.位移.矩阵.原点这六种类型的变形处理,下面将详细讲解transform的使用. 变形--旋转 rotate() div. ...
- 中科红旗倒下,谁来挑战windows
中科红旗解散 国产操作系统从此梦断 2月10日,关门上锁的中科红旗北京总部大门上粘贴了一张最新公告,这张公告彻底击破了那些仍然坚守公司工作的员工“拯救中国红旗”的希望.该公告称:因北京中科红旗软件技术 ...
- 【转】分享10VPN
以下介绍的vpn,都是有免费流量赠送的免费vpn,完全不免费的不在之列. 免费vpn因为用的人比较多,所以高峰时段可能会有点慢,但是人少时,还是比较顺畅的.对于偶尔浏览外网,看看新闻的同学来说,免费v ...
- shopnc 商城源码阅读笔记--开篇概述
关于shopnc 以下是摘抄自百度百科的关于shopnc的介绍: ShopNC商城系统,是天津市网城天创科技有限责任公司开发的一套多店模式的商城系统. 本系统具有商城系统非常完整和专业的功能与流程,系 ...
- 关于location
---恢复内容开始--- window.location跳转+替换+刷新 一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pag ...
- 配置node与express初试
http://www.nodejs.org/下载对应系统的node版本并安装 用npm包管理器安装需要的包 sudo npm install -g express sudo npm install - ...
- (转)《深入理解java虚拟机》学习笔记9——并发编程(一)
随着多核CPU的高速发展,为了充分利用硬件的计算资源,操作系统的并发多任务功能正变得越来越重要,但是CPU在进行计算时,还需要从内存读取输出,并将计算结果存放到内存中,然而由于CPU的运算速度比内存高 ...
- 查看某一个点是否在某个多边形内 使用ST_Contains函数
查看某一个点是否在某个多边形内 使用ST_Contains函数 --LINESTRING ( 121.312350 30.971457 , 121.156783 31.092221 , 121.35 ...
- Unity3d 如何找到游戏对象并改变其颜色
//游戏对象 private var obj:GameObject; //渲染器 private var render:Renderer; //贴图 private var texture:Textu ...
- HTML标签<b>与<strong>以及<i>与<em>的区别
在一般情况下,<b>和<strong>标签的显示效果一样,<i>和<em>标签的显示效果一样.那么它们的区别在哪呢?我们应该使用哪种标签呢? 在w3sc ...