mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-06 20:54:19 +00:00
docs: add Japanese translate documents (#1812)
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
This commit is contained in:
committed by
GitHub
parent
2487a27036
commit
954c45864b
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
File: climbing_stairs_dfs.py
|
||||
Created Time: 2023-06-30
|
||||
Author: krahets (krahets@163.com)
|
||||
"""
|
||||
|
||||
|
||||
def dfs(i: int) -> int:
|
||||
"""探索"""
|
||||
# 既知の dp[1] と dp[2] は、それらを返す
|
||||
if i == 1 or i == 2:
|
||||
return i
|
||||
# dp[i] = dp[i-1] + dp[i-2]
|
||||
count = dfs(i - 1) + dfs(i - 2)
|
||||
return count
|
||||
|
||||
|
||||
def climbing_stairs_dfs(n: int) -> int:
|
||||
"""階段登り:探索"""
|
||||
return dfs(n)
|
||||
|
||||
|
||||
"""ドライバーコード"""
|
||||
if __name__ == "__main__":
|
||||
n = 9
|
||||
|
||||
res = climbing_stairs_dfs(n)
|
||||
print(f"{n} 段登り、合計 {res} 通りの解がある")
|
||||
Reference in New Issue
Block a user