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,34 +8,34 @@ from collections import deque
class TreeNode:
"""二分木ノードクラス"""
"""二分木のノードクラス"""
def __init__(self, val: int = 0):
self.val: int = val # ノード値
self.val: int = val # ノードの値
self.height: int = 0 # ノードの高さ
self.left: TreeNode | None = None # 左子ノードへの参照
self.right: TreeNode | None = None # 右子ノードへの参照
self.left: TreeNode | None = None # 左の子ノードへの参照
self.right: TreeNode | None = None # 右の子ノードへの参照
# シリアライズの符号化規則は以下を参照:
# https://www.hello-algo.com/chapter_tree/array_representation_of_tree/
# 二分木の配列表現:
# シリアライズの符号化規則は次を参照:
# https://www.hello-algo.com/ja/chapter_tree/array_representation_of_tree/
# 二分木の配列表現:
# [1, 2, 3, 4, None, 6, 7, 8, 9, None, None, 12, None, None, 15]
# 二分木の連結リスト表現:
# /——— 15
# /——— 7
# /——— 3
# | \——— 6
# | \——— 12
# 二分木の連結リスト表現:
# /——— 15
# /——— 7
# /——— 3
# | \——— 6
# | \——— 12
# ——— 1
# \——— 2
# | /——— 9
# \——— 4
# \——— 8
# \——— 2
# | /——— 9
# \——— 4
# \——— 8
def list_to_tree_dfs(arr: list[int], i: int) -> TreeNode | None:
"""リストを二分木にデシリアライズする: 再帰"""
# 添字が配列長を超えるか、対応する要素が None なら、None を返す
"""リストから二分木へデシリアライズ:再帰"""
# 添字が配列の長さを超えるか、対応要素が None なら None を返す
if i < 0 or i >= len(arr) or arr[i] is None:
return None
# 現在のノードを構築する
@@ -47,12 +47,12 @@ def list_to_tree_dfs(arr: list[int], i: int) -> TreeNode | None:
def list_to_tree(arr: list[int]) -> TreeNode | None:
"""リストを二分木にデシリアライズする"""
"""リストから二分木へデシリアライズ"""
return list_to_tree_dfs(arr, 0)
def tree_to_list_dfs(root: TreeNode, i: int, res: list[int]) -> list[int]:
"""二分木をリストにシリアライズする: 再帰"""
"""二分木をシリアライズしてリストにする:再帰"""
if root is None:
return
if i >= len(res):
@@ -63,7 +63,7 @@ def tree_to_list_dfs(root: TreeNode, i: int, res: list[int]) -> list[int]:
def tree_to_list(root: TreeNode | None) -> list[int]:
"""二分木をリストにシリアライズする"""
"""二分木をシリアライズしてリストにする"""
res = []
tree_to_list_dfs(root, 0, res)
return res