7 kyu
Complete The Pattern #2
2,309 of 7,400DivyanshBatham
Description:
Task:
You have to write a function pattern
which returns the following Pattern (See Pattern & Examples) upto n
number of rows.
- Note:
Returning
the pattern is not the same asPrinting
the pattern.
Rules/Note:
- If
n < 1
then it should return "" i.e. empty string. - There are
no whitespaces
in the pattern.
Pattern:
(n)(n-1)(n-2)...4321
(n)(n-1)(n-2)...432
(n)(n-1)(n-2)...43
(n)(n-1)(n-2)...4
...............
..............
(n)(n-1)(n-2)
(n)(n-1)
(n)
Examples:
pattern(4):
4321 432 43 4
pattern(11):
1110987654321 111098765432 11109876543 1110987654 111098765 11109876 1110987 111098 11109 1110 11
- Hint: Use \n in string to jump to next line
ASCII Art
Puzzles
Similar Kata:
Stats:
Created | Jun 6, 2015 |
Published | Jun 6, 2015 |
Warriors Trained | 15216 |
Total Skips | 1429 |
Total Code Submissions | 33101 |
Total Times Completed | 7400 |
JavaScript Completions | 2309 |
Ruby Completions | 496 |
Python Completions | 2285 |
C# Completions | 1076 |
Haskell Completions | 201 |
Java Completions | 1744 |
C++ Completions | 613 |
CFML Completions | 9 |
Julia Completions | 14 |
Total Stars | 145 |
% of votes with a positive feedback rating | 90% of 876 |
Total "Very Satisfied" Votes | 719 |
Total "Somewhat Satisfied" Votes | 132 |
Total "Not Satisfied" Votes | 25 |