5 kyu

Complete the triangle pattern

91 of 197myjinxin2015

Description:

When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process --myjinxin2015 said

Description:

Give you two number m and n(two positive integer, m < n), make a triangle pattern with number sequence m to n. The order is clockwise, starting from the top corner, like this:

 When m=1 n=10  triangle is:
    1
   9 2
  8 0 3
 7 6 5 4

Note: The pattern only uses the last digit of each number; Each row separated by "\n"; Each digit separated by a space; Left side may need pad some spaces, but don't pad the right side; If m to n can not make the triangle, return "".

Some examples:

makeTriangle(1,3) should return:
 1
3 2

makeTriangle(6,20) should return: 

    6
   7 7
  6 8 8
 5 0 9 9
4 3 2 1 0

makeTriangle(1,12) should return ""
 
Puzzles

Stats:

CreatedNov 13, 2016
PublishedNov 13, 2016
Warriors Trained1447
Total Skips96
Total Code Submissions1547
Total Times Completed197
JavaScript Completions91
Python Completions108
Haskell Completions6
Total Stars63
% of votes with a positive feedback rating93% of 64
Total "Very Satisfied" Votes55
Total "Somewhat Satisfied" Votes9
Total "Not Satisfied" Votes0
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • docgunthrop Avatar
  • JohanWiltink Avatar
  • SQSCWQ Avatar
Ad