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 ...
随机推荐
- Jquery 禁用 a 标签 onclick 事件30秒后可用
<a href="javascript:;" id="sendToTel" >发送短信</a> <script type=&quo ...
- WF 快速入门
WF(Windows Workflow Foundation ,中文译为:Windows工作流基础)是一种基于更高级抽象概念的编程语言,适合于实现业务流程.虽然可以通过使用图形化的工具(Workflo ...
- Oracle SGA参数调整
一. SGA的组成: 自动 SGA 管理后,Oracle 可以自动为我们调整以下内存池的大小: shared pool buffer cache large pool java pool stream ...
- NFS网络文件共享服务
NFS-网络文件系统,它的主要功能是通过网络让不同的主机系统之间可以彼此共享文件或目录. NFS在企业中得应用场景 在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频.图片.附件等静 ...
- 1090. Highest Price in Supply Chain (25)
时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A supply chain is a network of r ...
- TabControl控件
private void Form1_Load(object sender, EventArgs e) { #region 显示样式 tabControl1.ImageList = imageList ...
- You have new mail in /var/spool/mail/root 烦不烦你?
http://blog.csdn.net/yx_l128125/article/details/7425182
- c# 赋值后最后一项数据部分丢失
赋值,赋值后 原因,在添加后立即调用clear()清除数据....
- netty sample
http://netty.io/wiki/ https://github.com/netty/netty/tree/master/example/src/main/java/io/netty/exam ...
- 写作技巧--Simile明喻