Share your repls and programming experiences

← Back to all posts
Amical Puzzle
Mikeh1 (1)

[0:30, 20.12.2020] Amichai: Engineering staircases:
Each type of staircase should consist of 2 or more steps.

  • No two steps are allowed to be at the same height.
  • Each step must be lower than the previous one.
  • All steps must contain at least one brick.
    A staircase's height is classified as the total amount of bricks that make up that step.
    For example, when staircase's hight, N, is equal to 3, you have only 1 choice of how to build the staircase, with the first step having a height of 2 and the second step having a height of 1.

Write a function Hight(int N) that given the hight of the staircase returns the number of different ways to build the staircase.

cases:
Hight(3) = 1 # (2,1)
Hight(4) = 1 # (3,1)
Hight(5) = 2 # (4,1) (3,2)
Hight(200) = 487067745
N >= 200 --> ???