7 kyu

Complete The Pattern #5 - Even Ladder

687 of 1,818DivyanshBatham

Description:

Task:

You have to write a function pattern which creates the following pattern up to n/2 number of lines.

  • If n <= 1 then it should return "" (i.e. empty string).
  • If any odd number is passed as argument then the pattern should last up to the largest even number which is smaller than the passed odd number.

Examples:

n = 8:

22
4444
666666
88888888

n = 5:

22
4444

Note: There are no spaces in the pattern.

Hint: Use \n in string to jump to next line.

ASCII Art
Fundamentals

Stats:

CreatedJun 7, 2015
PublishedJun 7, 2015
Warriors Trained2791
Total Skips212
Total Code Submissions4709
Total Times Completed1818
JavaScript Completions687
Ruby Completions236
Python Completions838
C# Completions130
Total Stars31
% of votes with a positive feedback rating92% of 341
Total "Very Satisfied" Votes291
Total "Somewhat Satisfied" Votes46
Total "Not Satisfied" Votes4
Total Rank Assessments15
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • DivyanshBatham Avatar
  • dnolan Avatar
  • GiacomoSorbi Avatar
  • user5036852 Avatar
  • user9644768 Avatar
  • hobovsky Avatar
  • Admiraal Avatar
  • Just4FunCoder Avatar
Ad