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 | 228 Views, 17230 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 | 228 Views, 17230 Search Bots | 74 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Problem: Word Ordering in a Different Alphabetical Order
  2. New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
  3. Plus One
  4. Daily Interview Problem: Running Median
  5. Daily Interview Problem: Product of Array Except Self
  6. Making a Height Balanced Binary Search Tree
  7. [Daily Problem] Longest Increasing Subsequence
  8. Spectrum Master
  9. Daily Interview Problem: Queue Using Two Stacks
  10. Algorithm Interview: Maximum Path Sum in Binary Tree

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />