To the Top
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 | 297 Views, 19067 Search Bots | 74 Words

Subscribe to Feed Burner | Browse | Archive
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?
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Problem, Data Structures and Algorithms, | English | Home Page | Cateogry: Computing | 297 Views, 19067 Search Bots | 74 Words Subscribe to Feed Burner

Related Articles

  1. [Daily Problem] Remove Consecutive Nodes that Sum to 0
  2. Daily Interview Problem: Find the k-th Largest Element in a List
  3. Algorithm Interview Question: H-Index
  4. Algorithm Interview Question: Max and Min with Limited Comparisons
  5. Detect Linked List Cycle
  6. Print a tree level-by-level, with line-breaks
  7. ImageMagick Vulnerabilities -  CVE-2016–3714
  8. Design Tic-Tac-Toe
  9. [Daily Problem] Witness of The Tall People
  10. Daily Interview Problem: Group Words that are Anagrams

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />