Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 490 Bytes

File metadata and controls

27 lines (20 loc) · 490 Bytes

Steps generator

Instructions

Given a positive integer n implement a function which returns an array representing the generated steps with n levels using the # character. Make sure the step has appropriate number of spaces on the right hand side!

Challenge | solution

Examples

generate_steps(2)
    '# '
    '##'

generate_steps(3)
    '#  '
    '## '
    '###'

generate_steps(4)
    '#   '
    '##  '
    '### '
    '####'