Complete-Preparation

🎉 One-stop destination for all your technical interview Preparation 🎉

View the Project on GitHub

70. Climbing Stairs 🌟

You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Tip by striver to find if a problem can be solved by dp.

Shortcut to write dp solution

  1. Try to represent problem in terms of indexes.
  2. Do all possible operations on that index according to steps.
  3. Sum/find min/ find max of all steps according to the problem description.

Solution