ProgrammingVery hard
A program climbs a staircase of 5 steps, each move going up one or two steps. How many distinct ways are there?
- A. 8
- B. 5
- C. 6
- D. 13
Correct answer: A. 8
The counts satisfy f(n) = f(n - 1) + f(n - 2) with f(1) = 1 and f(2) = 2, giving f(5) = 8.
More C Programming questions
- The number of subsets of a 4-element set with an even number of elements is what?
- The longest common subsequence of "abc" and "ac" has length?
- The sum of the entries of row 4 of Pascal's triangle (row 0 at the top) is what?
- How many 1s are on the main diagonal of a 4 x 4 identity matrix?
- printf("%d", builtinpopcount(1023)); Is this a portable C expression? What does it mean for the count of 1 bits in 1023?
- The lowest bit that is zero in x = 0b1011 is isolated by ~x & (x + 1). What value does this give?