|
| 1 | +{ |
| 2 | + "problem_name": "climbing_stairs", |
| 3 | + "solution_class_name": "Solution", |
| 4 | + "problem_number": "70", |
| 5 | + "problem_title": "Climbing Stairs", |
| 6 | + "difficulty": "Easy", |
| 7 | + "topics": "Math, Dynamic Programming, Memoization", |
| 8 | + "tags": ["grind-75"], |
| 9 | + "readme_description": "You are climbing a staircase. It takes `n` steps to reach the top.\n\nEach time you can either climb `1` or `2` steps. In how many distinct ways can you climb to the top?", |
| 10 | + "readme_examples": [ |
| 11 | + { |
| 12 | + "content": "```\nInput: n = 2\nOutput: 2\n```\n**Explanation:** There are two ways to climb to the top.\n1. 1 step + 1 step\n2. 2 steps" |
| 13 | + }, |
| 14 | + { |
| 15 | + "content": "```\nInput: n = 3\nOutput: 3\n```\n**Explanation:** There are three ways to climb to the top.\n1. 1 step + 1 step + 1 step\n2. 1 step + 2 steps\n3. 2 steps + 1 step" |
| 16 | + } |
| 17 | + ], |
| 18 | + "readme_constraints": "- 1 <= n <= 45", |
| 19 | + "readme_additional": "", |
| 20 | + "solution_imports": "", |
| 21 | + "solution_methods": [ |
| 22 | + { "name": "climb_stairs", "parameters": "n: int", "return_type": "int", "dummy_return": "1" } |
| 23 | + ], |
| 24 | + "test_imports": "import pytest\nfrom leetcode_py.test_utils import logged_test\nfrom .solution import Solution", |
| 25 | + "test_class_name": "ClimbingStairs", |
| 26 | + "test_helper_methods": [ |
| 27 | + { "name": "setup_method", "parameters": "", "body": "self.solution = Solution()" } |
| 28 | + ], |
| 29 | + "test_methods": [ |
| 30 | + { |
| 31 | + "name": "test_climb_stairs", |
| 32 | + "parametrize": "n, expected", |
| 33 | + "parametrize_typed": "n: int, expected: int", |
| 34 | + "test_cases": "[(1, 1), (2, 2), (3, 3), (4, 5), (5, 8), (6, 13), (10, 89), (20, 10946), (45, 1836311903)]", |
| 35 | + "body": "result = self.solution.climb_stairs(n)\nassert result == expected" |
| 36 | + } |
| 37 | + ], |
| 38 | + "playground_imports": "from solution import Solution", |
| 39 | + "playground_test_case": "# Example test case\nn = 3\nexpected = 3", |
| 40 | + "playground_execution": "result = Solution().climb_stairs(n)\nresult", |
| 41 | + "playground_assertion": "assert result == expected" |
| 42 | +} |
0 commit comments