5 kyu
Pattern Generator
68 of 228candrabeqx
Description:
Pattern Generator
create a function that accepts 1 (one) parameter and returns a string that has such a pattern:
parameter: 1, generate pattern:
x```
parameter: 2, generate pattern:
x x x x
parameter: 3, generate pattern:
x x x o x x x
parameter: 4, generate pattern:
x x o x x o o x x o x x
parameter: 5, generate pattern:
x x o x o x x o x o x x o x o x x
parameter: 6, generate pattern:
x x o x o x x o x x o x x o x x o x x o x o x x
and so on...
assume that:
N
is an integer within range [-100..200]the function should return empty string if given parameter lower than
1
additional info
the result is compared with smart algorithm, so you don't have to worry about additional space characters that's not visible.
for example, this string:
x \n x \n o x \n o x \nx o x o x\n x o \n x o \n x \n x \n
which is seen as:
x
x
o x
o x
x o x o x
x o
x o
x
x
is treated the same as:
x\n x\n o x\n o x\nx o x o x\n x o\n x o\n x\n x
which is seen as:
x
x
o x
o x
x o x o x
x o
x o
x
x
because both are visibly the same.
Algorithms
ASCII Art
Similar Kata:
Stats:
Created | Aug 9, 2017 |
Published | Aug 9, 2017 |
Warriors Trained | 1764 |
Total Skips | 533 |
Total Code Submissions | 4769 |
Total Times Completed | 228 |
JavaScript Completions | 68 |
PHP Completions | 49 |
Java Completions | 51 |
Crystal Completions | 4 |
Ruby Completions | 17 |
Python Completions | 73 |
Total Stars | 57 |
% of votes with a positive feedback rating | 95% of 59 |
Total "Very Satisfied" Votes | 54 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 9 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |