File: root - text - article - 2019 - 10 - number-of-ways-to-climb-stairs.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 446 Views, 21478 Search Bots | 74 Words
| Browse | Archive
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Category: Computing | 446 Views, 21478 Search Bots | 74 Words
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Hi, here's your problem today. This problem was recently asked by LinkedIn:
You are given a positive integer N which represents the number of steps in a staircase. You can either climb 1 or 2 steps at a time. Write a function that returns the number of unique ways to climb the stairs.
Can you find a solution in O(n) time?
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Cateogry: Computing | 446 Views, 21478 Search Bots | 74 Words You are given a positive integer N which represents the number of steps in a staircase. You can either climb 1 or 2 steps at a time. Write a function that returns the number of unique ways to climb the stairs.
def staircase(n):
# Fill this in.
print staircase(4)
# 5
print staircase(5)
# 8
Can you find a solution in O(n) time?
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Related Articles
- Algorithm Interview Question: Max and Min with Limited Comparisons
- CPU Utilization
- Find the non-duplicate number
- Algorithm Interview Question: Find the Single Element in an Array of Duplicates
- Autorun.inf Virus Protection
- ImageMagick Vulnerabilities - CVE-2016–3714
- Daily Interview Puzzle: Intersection of Linked Lists
- Algorithm Interview: Maximum Path Sum in Binary Tree
- Daily Interview Problem: Minimum Removals for Valid Parenthesis
- Daily Interview Problem: Find the k-th Largest Element in a List
©2006~2024 SteakOverCooked - 0.009 Seconds(s) - 5853.948 KB/s - 9 Online
Memory: 528.45 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
![](/images/top.jpg)
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !