K29

Climbing Stairs

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: NUMERIC

Problem Statement & Objective

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?

Function Signature (Python)

climbing_stairs(n: int) -> int

Input & Output Contract

Output Rule:Farklı tırmanma yollarının sayısı (tam sayı).

System Constraints

1 <= n <= 45

Example Execution Walkthrough

n = 2 -> 1+1, 2 -> 2 yol
n = 3 -> 1+1+1, 1+2, 2+1 -> 3 yol

Example Test Scenarios (3)

Example 1
Input:[2]
Expected Output:2
Example 2
Input:[3]
Expected Output:3
Example 3: 5 Yol
Input:[4]
Expected Output:5
Loading Python Editor...
Input Parameters
[
  2
]
Expected Output
2