Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个人每次只能走一层楼梯或者两层楼梯,问走到第 80 层楼梯一共有多少种方法 #291

Open
lgwebdream opened this issue Jul 6, 2020 · 2 comments
Labels
快手 company 算法 teach_tag

Comments

@lgwebdream
Copy link
Owner

No description provided.

@lgwebdream lgwebdream added 快手 company 算法 teach_tag labels Jul 6, 2020
@lgwebdream
Copy link
Owner Author

扫描下方二维码,获取答案以及详细解析,同时可解锁800+道前端面试题。

@AAA611
Copy link

AAA611 commented Aug 31, 2022

function fn(n) {
  let p = 1
  let q = 2
  let res
  for (let i = 3; i <= n; i++) {
    res = p + q
    p = q
    q = res
  }
  return res
}
console.log(fn(3));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
快手 company 算法 teach_tag
Projects
None yet
Development

No branches or pull requests

2 participants