文件: root - text - article - 2019 - 10 - number-of-ways-to-climb-stairs.txt
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | 英文 | 主页 | 类别: 计算机科学 | 519 次阅读, 22880 次搜索 | 74 个单词
| 浏览 | 博客存档
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | 英文 | 主页 | 类别: 计算机科学 | 519 次阅读, 22880 次搜索 | 74 个单词
| 浏览 | 博客存档
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?
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | 英文 | 主页 | 类别: 计算机科学 | 519 次阅读, 22880 次搜索 | 74 个单词 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?
猜您喜欢...
- Longest Substring Without Repeating Characters
- Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
- Daily Interview Problem: Jump to the End
- Daily Interview Problem: Get all Values at a Certain Height in a Binary Tree
- Daily Interview Question: Longest Sequence with Two Unique Numbers
- Algorithm Interview Question: H-Index
- Daily Interview Problem: Deepest Node in a Binary Tree
- Floor and Ceiling of a Binary Search Tree
- CPU Utilization
- Daily Interview Problem: Trapping Rainwater
©2006~2024 牛排过熟 - 0.0064 秒 - 3028.122 KB/s - 36 在线 内存: 493.01 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
牛排怎么做才好吃? | <meta name="机器人" content="索引, 跟踪">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
评论 (0)
读写完全 - 一般 - 最小 - 表格 - 所有评论 - 统计
当前页暂时没有评论。