Ways to climb 8 stairs (1 or 2 steps).
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
int n = 8;
int a = 1, b = 1;
for (int k = 2; k <= n; k++) { int t = a + b; a = b; b = t; }
Console.WriteLine(b);
}
}
Try solving on your own first, then reveal the official answer.
Same as Fibonacci — classic DP intro.