页面顶部 Top
文件:  root - text - article - 2019 - 10 - number-of-ways-to-climb-stairs.txt
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | 英文 | 主页 | 类别: 计算机科学 | 230 次阅读, 17378 次搜索 | 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.


def staircase(n):
# Fill this in.

print staircase(4)
# 5
print staircase(5)
# 8


Can you find a solution in O(n) time?
标签: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | 英文 | 主页 | 类别: 计算机科学 | 230 次阅读, 17378 次搜索 | 74 个单词 定阅此目录的博客

猜您喜欢...

  1. Daily Interview Puzzle: Minimum Size Subarray Sum
  2. Reverse a Linked List
  3. Number of Ways to Climb Stairs
  4. Algorithm Interview: Permutations of numbers
  5. Longest Substring Without Repeating Characters
  6. Print a tree level-by-level, with line-breaks
  7. Daily Interview Problem: Buddy Strings
  8. Algorithm Interview Question: Symmetric k-ary Tree
  9. Daily Interview Puzzle: Falling Dominoes
  10. YES!!

评论 (0)

您的邮件 (不公开域名部分):

您的评论:

悄悄话(发邮件) 颜色 更多笑脸 S x y @

验证码 (点击图片更新):

    当前页暂时没有评论。


最后更新: October 30 2020 14:21:12 | RSS Subscription
牛排怎么做才好吃? | <meta name="机器人" content="不索引, 跟踪" />