Retranslate the complete Japanese online edition from Chinese (#2008)

* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
This commit is contained in:
Yudong Jin
2026-10-30 02:12:26 +08:00
committed by GitHub
parent 455e8c1281
commit 7257641e0e
1987 changed files with 23531 additions and 23261 deletions

View File

@@ -8,35 +8,35 @@ Author: krahets (krahets@163.com)
def backtrack(
state: list[int], choices: list[int], selected: list[bool], res: list[list[int]]
):
"""バックトラッキング:順列 II"""
# 状態の長さが要素数に等しければ、解を記録
"""バックトラッキング:すべての順列 II"""
# 状態の長さが要素数と等しくなったら、解を記録する
if len(state) == len(choices):
res.append(list(state))
return
# すべての選択肢を走査
# すべての選択肢を走査する
duplicated = set[int]()
for i, choice in enumerate(choices):
# 枝刈り:要素の重複選択を許可せず、同値要素の重複選択も許可しない
# 枝刈り:同じ要素の再選択も、等しい値を持つ要素の重複選択も許可しない
if not selected[i] and choice not in duplicated:
# 試行: 選択を行い、状態を更新
duplicated.add(choice) # 選択済みの要素値を記録
# 試行:選択を行い、状態を更新する
duplicated.add(choice) # 選択済みの要素の値を記録する
selected[i] = True
state.append(choice)
# 次の選択へ進む
# 次の選択に進む
backtrack(state, choices, selected, res)
# バックトラック:選択を取り消し、前の状態に戻す
# 復元:選択を取り消し、以前の状態に戻す
selected[i] = False
state.pop()
def permutations_ii(nums: list[int]) -> list[list[int]]:
"""全順列 II"""
"""すべての順列 II"""
res = []
backtrack(state=[], choices=nums, selected=[False] * len(nums), res=res)
return res
"""Driver Code"""
"""実行用コード"""
if __name__ == "__main__":
nums = [1, 2, 2]