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,42 +8,42 @@
/* 線形探索(配列) */
int linearSearchArray(vector<int> &nums, int target) {
// 配列を走査
// 配列を走査する
for (int i = 0; i < nums.size(); i++) {
// 目標要素が見つかったらそのインデックスを返す
// 目的の要素が見つかったので、そのインデックスを返す
if (nums[i] == target)
return i;
}
// 目標要素が見つからなければ -1 を返す
// 目的の要素が見つからなかったので、-1 を返す
return -1;
}
/* 線形探索(連結リスト) */
ListNode *linearSearchLinkedList(ListNode *head, int target) {
// 連結リストを走査
// 連結リストを走査する
while (head != nullptr) {
// 対象ノードが見つかったら、それを返す
// 目的のノードが見つかったので、それを返す
if (head->val == target)
return head;
head = head->next;
}
// 対象ノードが見つからない場合は `nullptr` を返す
// 目的のノードが見つからなかったので、nullptr を返す
return nullptr;
}
/* Driver Code */
/* 実行用コード */
int main() {
int target = 3;
/* 配列で線形探索を行う */
vector<int> nums = {1, 5, 3, 2, 4, 7, 5, 9, 10, 8};
int index = linearSearchArray(nums, target);
cout << "対象要素 3 のインデックス = " << index << endl;
cout << "目的の要素 3 のインデックス = " << index << endl;
/* 連結リストで線形探索を行う */
ListNode *head = vecToLinkedList(nums);
ListNode *node = linearSearchLinkedList(head, target);
cout << "対象ノード値 3 に対応するノードオブジェクトは " << node << endl;
cout << "目的のノードの値 3 に対応するノードオブジェクトは " << node << endl;
return 0;
}