From 68ddb8ca054549532f0d3207a6c7b05bd3e90899 Mon Sep 17 00:00:00 2001 From: Renkin <906155099@qq.com> Date: Tue, 14 Nov 2023 13:56:24 +0800 Subject: [PATCH] feat: i18n update --- src/codeTemplates/backtrack.js | 46 +++++++---- src/codeTemplates/bfs.js | 19 +++-- src/codeTemplates/binarySearch.js | 40 ++++++--- src/codeTemplates/hand-writing.js | 17 ++-- src/codeTemplates/heap.js | 11 ++- src/codeTemplates/prime.js | 11 ++- src/codeTemplates/rotate.js | 11 ++- src/codeTemplates/segmentTree.js | 31 ++++--- src/codeTemplates/sliding-window.js | 41 +++++++--- src/codeTemplates/suffix_array.js | 8 +- src/codeTemplates/trie.js | 28 +++++-- src/codeTemplates/uf.js | 25 ++++-- src/locales/en.js | 122 ++++++++++++++++++++++++++++ src/locales/zh.js | 121 +++++++++++++++++++++++++++ 14 files changed, 441 insertions(+), 90 deletions(-) diff --git a/src/codeTemplates/backtrack.js b/src/codeTemplates/backtrack.js index 34a19dd..42dbfe1 100644 --- a/src/codeTemplates/backtrack.js +++ b/src/codeTemplates/backtrack.js @@ -1,49 +1,62 @@ +const { t } = require("../locales"); module.exports = () => ({ logo: require("../imgs/backtrack.svg"), - title: "回溯", + // title: "回溯", + title: t("Locale.codeTemplate.backtrack.title"), list: [ { - text: "标准回溯(伪代码)", + // text: "标准回溯(伪代码)", + text: t("Locale.codeTemplate.backtrack.item1"), problems: [ { id: "combination-sum", - title: "39. 组合总和", + // title: "39. 组合总和", + title: t("Locale.problem.39"), }, { - title: "40. 组合总和 II", + // title: "40. 组合总和 II", + title: t("Locale.problem.40"), id: "combination-sum-ii", }, { - title: "46. 全排列", + // title: "46. 全排列", + title: t("Locale.problem.46"), id: "permutations", }, { - title: "47. 全排列 II", + // title: "47. 全排列 II", + title: t("Locale.problem.47"), id: "permutations-ii", }, { id: "N-Queens-II", - title: "52. N 皇后 II", + // title: "52. N 皇后 II", + title: t("Locale.problem.52"), }, { id: "subsets", - title: "78. 子集", + // title: "78. 子集", + title: t("Locale.problem.78"), }, { id: "subsets-ii", - title: "90. 子集 II", + // title: "90. 子集 II", + title: t("Locale.problem.90"), }, { id: "path-sum-ii", - title: "113. 路径总和 II", + // title: "113. 路径总和 II", + title: t("Locale.problem.113"), }, { id: "palindrome-partitioning", - title: "131. 分割回文串", + // title: "131. 分割回文串", + title: t("Locale.problem.131"), }, { id: "maximum-score-words-formed-by-letters", - title: "1255. 得分最高的单词集合", + // title: "1255. 得分最高的单词集合", + title: t("Locale.problem.1255"), }, ], codes: [ @@ -71,15 +84,18 @@ module.exports = () => ({ ], }, { - text: "笛卡尔积优化", + // text: "笛卡尔积优化", + text: t("Locale.codeTemplate.backtrack.item2"), problems: [ { id: "word-break-ii", - title: "140. 单词拆分 II", + // title: "140. 单词拆分 II", + title: t("Locale.problem.140"), }, { id: "ambiguous-coordinates", - title: "816. 模糊坐标", + // title: "816. 模糊坐标", + title: t("Locale.problem.816"), }, ], codes: [ diff --git a/src/codeTemplates/bfs.js b/src/codeTemplates/bfs.js index ad175d3..f18e64e 100644 --- a/src/codeTemplates/bfs.js +++ b/src/codeTemplates/bfs.js @@ -1,22 +1,27 @@ import bfsLogo from "../imgs/bfs.svg"; +const { t } = require("../locales"); export default () => ({ title: "BFS", logo: bfsLogo, list: [ { - text: "带层信息", + // text: "带层信息", + text: t("Locale.codeTemplate.BFS.item1"), problems: [ { - title: "513.找树左下角的值", + // title: "513.找树左下角的值", + title: t("Locale.problem.513"), id: "find-bottom-left-tree-value", }, { - title: "662. 二叉树最大宽度", + // title: "662. 二叉树最大宽度", + title: t("Locale.problem.662"), id: "maximum-width-of-binary-tree", }, { - title: "863. 二叉树中所有距离为 K 的结点", + // title: "863. 二叉树中所有距离为 K 的结点", + title: t("Locale.problem.863"), id: "all-nodes-distance-k-in-binary-tree", }, ], @@ -51,10 +56,12 @@ export default () => ({ ], }, { - text: "不带层信息", + // text: "不带层信息", + text: t("Locale.codeTemplate.BFS.item2"), problems: [ { - title: "116. 填充每个节点的下一个右侧节点指针", + // title: "116. 填充每个节点的下一个右侧节点指针", + title: t("Locale.problem.116"), id: "populating-next-right-pointers-in-each-node", }, ], diff --git a/src/codeTemplates/binarySearch.js b/src/codeTemplates/binarySearch.js index 7efd787..c1a5b8a 100644 --- a/src/codeTemplates/binarySearch.js +++ b/src/codeTemplates/binarySearch.js @@ -1,13 +1,17 @@ +const { t } = require("../locales"); module.exports = () => ({ - title: "二分法", + // title: "二分法", + title: t("Locale.codeTemplate.binarySearch.title"), logo: require("../imgs/half.svg"), list: [ { - text: "查找一个数", + // text: "查找一个数", + text: t("Locale.codeTemplate.binarySearch.item1"), problems: [ { id: "single-element-in-a-sorted-array", - title: "540. 有序数组中的单一元素", + // title: "540. 有序数组中的单一元素", + title: t("Locale.problem.540"), }, ], codes: [ @@ -92,15 +96,18 @@ module.exports = () => ({ ], }, { - text: "寻找最左边的满足条件的值", + // text: "寻找最左边的满足条件的值", + text: t("Locale.codeTemplate.binarySearch.item2"), problems: [ { id: "find-first-and-last-position-of-element-in-sorted-array", - title: "34. 在排序数组中查找元素的第一个和最后一个位置", + // title: "34. 在排序数组中查找元素的第一个和最后一个位置", + title: t("Locale.problem.34"), }, { id: "first-bad-version", - title: "278. 第一个错误的版本", + // title: "278. 第一个错误的版本", + title: t("Locale.problem.278"), }, ], codes: [ @@ -194,15 +201,18 @@ module.exports = () => ({ ], }, { - text: "寻找最右边的满足条件的值", + // text: "寻找最右边的满足条件的值", + text: t("Locale.codeTemplate.binarySearch.item3"), problems: [ { id: "find-first-and-last-position-of-element-in-sorted-array", - title: "34. 在排序数组中查找元素的第一个和最后一个位置", + // title: "34. 在排序数组中查找元素的第一个和最后一个位置", + title: t("Locale.problem.34"), }, { id: "sqrtx", - title: "69. x 的平方根", + // title: "69. x 的平方根", + title: t("Locale.problem.69"), }, ], codes: [ @@ -297,7 +307,8 @@ module.exports = () => ({ ], }, { - text: "寻找最左插入位置", + // text: "寻找最左插入位置", + text: t("Locale.codeTemplate.binarySearch.item4"), codes: [ { language: "py", @@ -344,12 +355,14 @@ function searchInsertLeft(nums, x) { problems: [ { id: "random-pick-with-weight", - title: "528. 按权重随机选择", + // title: "528. 按权重随机选择", + title: t("Locale.problem.528"), }, ], }, { - text: "寻找最右插入位置", + // text: "寻找最右插入位置", + text: t("Locale.codeTemplate.binarySearch.item5"), codes: [ { language: "py", @@ -395,7 +408,8 @@ function searchInsertRight(nums, x) { problems: [ { id: "find-first-and-last-position-of-element-in-sorted-array", - title: "34. 在排序数组中查找元素的第一个和最后一个位置", + // title: "34. 在排序数组中查找元素的第一个和最后一个位置", + title: t("Locale.problem.34"), }, ], }, diff --git a/src/codeTemplates/hand-writing.js b/src/codeTemplates/hand-writing.js index fe2bbb7..480dfb8 100644 --- a/src/codeTemplates/hand-writing.js +++ b/src/codeTemplates/hand-writing.js @@ -1,13 +1,18 @@ +const { t } = require("../locales"); + module.exports = () => ({ logo: require("../imgs/hand-writing.svg"), - title: "手撕算法", + // title: "手撕算法", + title: t("Locale.codeTemplate.handWriting.title"), list: [ { - text: "数组排序", + // text: "数组排序", + text: t("Locale.codeTemplate.handWriting.item1"), problems: [ { id: "sort-an-array", - title: "912. 排序数组", + // title: "912. 排序数组", + title: t("Locale.problem.912"), }, ], codes: [ @@ -160,11 +165,13 @@ class Solution: ], }, { - text: "链表排序", + // text: "链表排序", + text: t("Locale.codeTemplate.handWriting.item2"), problems: [ { id: "sort-list", - title: "148. 排序链表", + // title: "148. 排序链表", + title: t("Locale.problem.148"), }, ], codes: [ diff --git a/src/codeTemplates/heap.js b/src/codeTemplates/heap.js index 81cce23..42fc19c 100644 --- a/src/codeTemplates/heap.js +++ b/src/codeTemplates/heap.js @@ -1,3 +1,5 @@ +const { t } = require("../locales"); + const minHeapJSCode = ` function minHeap(A = []) { this.heapify(A); @@ -237,13 +239,16 @@ public class MinHeap { `; module.exports = () => ({ logo: require("../imgs/heap.svg"), - title: "堆", + // title: "堆", + title: t("Locale.codeTemplate.heap.title"), list: [ { - text: "小顶堆", + // text: "小顶堆", + text: t("Locale.codeTemplate.heap.item1"), problems: [ { - title: "1046. 最后一块石头的重量(这道题需要用大顶堆,不过都差不多)", + // title: "1046. 最后一块石头的重量(这道题需要用大顶堆,不过都差不多)", + title: t("Locale.problem.1046"), id: "last-stone-weight", }, ], diff --git a/src/codeTemplates/prime.js b/src/codeTemplates/prime.js index 4ba1a59..254bcaa 100644 --- a/src/codeTemplates/prime.js +++ b/src/codeTemplates/prime.js @@ -1,3 +1,5 @@ +const { t } = require("../locales"); + const pyCode = ` MAXN = int(1e5) flag = [True] * (MAXN + 10) # if flag[i] is true, then i is prime @@ -9,14 +11,17 @@ for i in range(2, int(MAXN ** 0.5) + 1): `; module.exports = () => ({ - title: "求质数", + // title: "求质数", + title: t("Locale.codeTemplate.prime.title"), // logo: require("../imgs/preSum.svg"), list: [ { - text: "质数筛选法", + // text: "质数筛选法", + text: t("Locale.codeTemplate.prime.item1"), problems: [ { - title: "2867. 统计树中的合法路径数目", + // title: "2867. 统计树中的合法路径数目", + title: t("Locale.problem.2867"), id: "count-valid-paths-in-a-tree", }, ], diff --git a/src/codeTemplates/rotate.js b/src/codeTemplates/rotate.js index c74f846..056cc5e 100644 --- a/src/codeTemplates/rotate.js +++ b/src/codeTemplates/rotate.js @@ -1,13 +1,18 @@ +const { t } = require("../locales"); + module.exports = () => ({ - title: "矩阵旋转", + // title: "矩阵旋转", + title: t("Locale.codeTemplate.rotate.title"), logo: require("../imgs/rotate.svg"), list: [ { - text: "顺时针 90° 旋转二维矩阵", + // text: "顺时针 90° 旋转二维矩阵", + text: t("Locale.codeTemplate.rotate.item1"), problems: [ { id: "determine-whether-matrix-can-be-obtained-by-rotation", - title: "1886.判断矩阵经轮转后是否一致", + // title: "1886.判断矩阵经轮转后是否一致", + title: t("Locale.problem.1886"), }, ], codes: [ diff --git a/src/codeTemplates/segmentTree.js b/src/codeTemplates/segmentTree.js index 06d41e5..7f4097f 100644 --- a/src/codeTemplates/segmentTree.js +++ b/src/codeTemplates/segmentTree.js @@ -1,4 +1,5 @@ import segmentLogo from "../imgs/segment.svg"; +import { t } from "../locales"; const pyCode = ` class SegmentTree: @@ -86,20 +87,24 @@ class SegmentTree: `; export default () => ({ - title: "线段树", + // title: "线段树", + title: t("Locale.codeTemplate.segmentTree.title"), logo: segmentLogo, link: "https://oi-wiki.org/ds/seg/", list: [ { - text: "区间和线段树", + // text: "区间和线段树", + text: t("Locale.codeTemplate.segmentTree.item1"), problems: [ { id: "range-sum-query-immutable", - title: "303. 区域和检索 - 数组不可变(使用一维前缀和会更简单)", + // title: "303. 区域和检索 - 数组不可变(使用一维前缀和会更简单)", + title: t("Locale.problem.303"), }, { id: "range-sum-query-mutable", - title: "307. 区域和检索 - 数组可修改", + // title: "307. 区域和检索 - 数组可修改", + title: t("Locale.problem.307"), }, ], codes: [ @@ -110,11 +115,13 @@ export default () => ({ ], }, { - text: "区间和懒更新(区间更新)线段树", + // text: "区间和懒更新(区间更新)线段树", + text: t("Locale.codeTemplate.segmentTree.item2"), problems: [ { id: "handling-sum-queries-after-update", - title: "2569. 更新数组后处理求和查询", + // title: "2569. 更新数组后处理求和查询", + title: t("Locale.problem.2569"), }, ], codes: [ @@ -193,11 +200,13 @@ export default () => ({ ], }, { - text: "计数线段树", + // text: "计数线段树", + text: t("Locale.codeTemplate.segmentTree.item3"), problems: [ { id: "create-sorted-array-through-instructions", - title: "1649. 通过指令创建有序数组", + // title: "1649. 通过指令创建有序数组", + title: t("Locale.problem.1649"), }, ], codes: [ @@ -261,11 +270,13 @@ class SegmentTree: ], }, { - text: "动态开点", + // text: "动态开点", + text: t("Locale.codeTemplate.segmentTree.item4"), problems: [ { id: "maximum-sum-queries", - title: "2736. 最大和查询", + // title: "2736. 最大和查询", + title: t("Locale.problem.2736"), }, ], codes: [ diff --git a/src/codeTemplates/sliding-window.js b/src/codeTemplates/sliding-window.js index 16431ef..aba8270 100644 --- a/src/codeTemplates/sliding-window.js +++ b/src/codeTemplates/sliding-window.js @@ -1,13 +1,18 @@ import windowLogo from "../imgs/window.svg"; +import { t } from "../locales"; + export default () => ({ - title: "滑动窗口", + // title: "滑动窗口", + title: t("Locale.codeTemplate.slidingWindow.title"), logo: windowLogo, list: [ { - text: "固定窗口(伪代码)", + // text: "固定窗口(伪代码)", + text: t("Locale.codeTemplate.slidingWindow.item1"), problems: [ { - title: "438. 找到字符串中所有字母异位词", + // title: "438. 找到字符串中所有字母异位词", + title: t("Locale.problem.438"), id: "find-all-anagrams-in-a-string", }, ], @@ -28,43 +33,53 @@ export default () => ({ ], }, { - text: "可变窗口(伪代码)", + // text: "可变窗口(伪代码)", + text: t("Locale.codeTemplate.slidingWindow.item2"), problems: [ { id: "longest-substring-without-repeating-characters", - title: "3. 无重复字符的最长子串", + // title: "3. 无重复字符的最长子串", + title: t("Locale.problem.3"), }, { - title: "76. 最小覆盖子串", + // title: "76. 最小覆盖子串", + title: t("Locale.problem.76"), id: "minimum-window-substring", }, { - title: "209. 长度最小的子数组", + // title: "209. 长度最小的子数组", + title: t("Locale.problem.209"), id: "minimum-size-subarray-sum", }, { id: "fruit-into-baskets", - title: "904. 水果成篮", + // title: "904. 水果成篮", + title: t("Locale.problem.904"), }, { - title: "930. 和相同的二元子数组", + // title: "930. 和相同的二元子数组", + title: t("Locale.problem.930"), id: "binary-subarrays-with-sum", }, { - title: "992. K 个不同整数的子数组", + // title: "992. K 个不同整数的子数组", + title: t("Locale.problem.992"), id: "subarrays-with-k-different-integers", }, { - title: "1004. 最大连续 1 的个数 III", + // title: "1004. 最大连续 1 的个数 III", + title: t("Locale.problem.1004"), id: "max-consecutive-ones-iii", }, { - title: "1234. 替换子串得到平衡字符串", + // title: "1234. 替换子串得到平衡字符串", + title: t("Locale.problem.1234"), id: "replace-the-substring-for-balanced-string", }, { - title: "1248. 统计「优美子数组」", + // title: "1248. 统计「优美子数组」", + title: t("Locale.problem.1248"), id: "count-number-of-nice-subarrays", }, ], diff --git a/src/codeTemplates/suffix_array.js b/src/codeTemplates/suffix_array.js index ea37f22..aa798af 100644 --- a/src/codeTemplates/suffix_array.js +++ b/src/codeTemplates/suffix_array.js @@ -1,9 +1,13 @@ +import { t } from "../locales"; + export default () => ({ - title: "后缀树组", + // title: "后缀树组", + title: t("Locale.codeTemplate.suffixArray.title"), logo: "", list: [ { - text: "标准版", + // text: "标准版", + text: t("Locale.codeTemplate.suffixArray.item1"), problems: [], codes: [ { diff --git a/src/codeTemplates/trie.js b/src/codeTemplates/trie.js index 8a3923d..1898c0a 100644 --- a/src/codeTemplates/trie.js +++ b/src/codeTemplates/trie.js @@ -1,4 +1,5 @@ import treeLogo from "../imgs/tree.svg"; +import { t } from "../locales"; const cppCode = ` struct TrieNode { @@ -216,38 +217,47 @@ class Trie { } `; export default () => ({ - title: "前缀树", + // title: "前缀树", + title: t("Locale.codeTemplate.trie.title"), logo: treeLogo, list: [ { - text: "标准前缀树", + // text: "标准前缀树", + text: t("Locale.codeTemplate.trie.item1"), problems: [ { - title: "208.实现 Trie (前缀树)", + // title: "208.实现 Trie (前缀树)", + title: t("Locale.problem.208"), id: "implement-trie-prefix-tree", }, { - title: "211.添加与搜索单词 - 数据结构设计", + // title: "211.添加与搜索单词 - 数据结构设计", + title: t("Locale.problem.211"), id: "add-and-search-word-data-structure-design", }, { id: "word-search-ii", - title: "212.单词搜索 II", + // title: "212.单词搜索 II", + title: t("Locale.problem.212"), }, { id: "concatenated-words", - title: "472.连接词", + // title: "472.连接词", + title: t("Locale.problem.472"), }, { - title: "648. 单词替换", + // title: "648. 单词替换", + title: t("Locale.problem.648"), id: "replace-words", }, { id: "short-encoding-of-words", - title: "820.单词的压缩编码", + // title: "820.单词的压缩编码", + title: t("Locale.problem.820"), }, { - title: "1032.字符流", + // title: "1032.字符流", + title: t("Locale.problem.1032"), id: "stream-of-characters", }, ], diff --git a/src/codeTemplates/uf.js b/src/codeTemplates/uf.js index f9a3b00..7a7ab99 100644 --- a/src/codeTemplates/uf.js +++ b/src/codeTemplates/uf.js @@ -1,26 +1,33 @@ import ufLogo from "../imgs/uf.svg"; +import { t } from "../locales"; export default () => ({ - title: "并查集", + // title: "并查集", + title: t("Locale.codeTemplate.uf.title"), logo: ufLogo, list: [ { - text: "不带权并查集", + // text: "不带权并查集", + text: t("Locale.codeTemplate.uf.item1"), problems: [ { - title: "547. 朋友圈", + // title: "547. 朋友圈", + title: t("Locale.problem.547"), id: "friend-circles", }, { - title: "721. 账户合并", + // title: "721. 账户合并", + title: t("Locale.problem.721"), id: "accounts-merge", }, { - title: "990. 等式方程的可满足性", + // title: "990. 等式方程的可满足性", + title: t("Locale.problem.990"), id: "satisfiability-of-equality-equations", }, { - title: "1202. 交换字符串中的元素", + // title: "1202. 交换字符串中的元素", + title: t("Locale.problem.1202"), id: "smallest-string-with-swaps", }, ], @@ -55,10 +62,12 @@ class UF: ], }, { - text: "带权并查集", + // text: "带权并查集", + text: t("Locale.codeTemplate.uf.item2"), problems: [ { - title: "399. 除法求值", + // title: "399. 除法求值", + title: t("Locale.problem.399"), id: "evaluate-division", }, ], diff --git a/src/locales/en.js b/src/locales/en.js index 8311409..e2f68a2 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -60,43 +60,89 @@ const en = { notYet: "Not yet", }, problem: { + 3: "3. Longest Substring Without Repeating Characters", 10: "10. Regular Expression Matching", + 34: "34. Find First and Last Position of Element in Sorted Array", + 39: "39. Combination Sum", + 40: "40. Combination Sum II", 44: "44. Wildcard Matching", + 46: "46. Permutations", + 47: "47. Permutations II", + 52: "52. N-Queens II", 62: "62. Unique Paths", 63: "63. Unique Paths II", 64: "64. Minimum Path Sum", 69: "69. Sqrt(x)", 70: "70. Climbing Stairs", 72: "72. Edit Distance", + 76: "76. Minimum Window Substring", + 78: "78. Subsets", + 90: "90. Subsets II", + 113: "113. Path Sum II", + 116: "116. Populating Next Right Pointers in Each Node", + 131: "131. Palindrome Partitioning", + 140: "140. Word Break II", + 148: "148. Sort List", 174: "174. Dungeon Game", 198: "198. House Robber", + 208: "208. Implement Trie (Prefix Tree)", + 209: "209. Minimum Size Subarray Sum", + 211: "211. Design Add and Search Words Data Structure", + 212: "212. Word Search II", 233: "233. Number of Digit One", 278: "278. First Bad Version", "278_desc": "The idea of the leftmost and rightmost is the same. Everyone can practice two questions. The actual situation can use different binary search according to the meaning of the question.", 292: "292. Nim Game", + 303: "303. Range Sum Query - Immutable(It is simpler to use one-dimensional prefix sums)", + 307: "307. Range Sum Query - Mutable", 327: "327. Count of Range Sum", 322: "322. Coin Change", 337: "337. House Robber III", 357: "357. Count Numbers with Unique Digits", + 399: "399. Evaluate Division", 416: "416. Partition Equal Subset Sum", + 438: "438. Find All Anagrams in a String", 464: "464. Can I Win", + 472: "472. Concatenated Words", 493: "493. Reverse Pairs", + 513: "513. Find Bottom Left Tree Value", 518: "518. Coin Change 2", + 528: "528. Random Pick with Weight", + 540: "540. Single Element in a Sorted Array", + 547: "547. Number of Provinces", 576: "576. Out of Boundary Paths(changed from selecting two directions to selecting four directions)", + 648: "648. Replace Words", + 662: "662. Maximum Width of Binary Tree", 698: "698. Partition to K Equal Sum Subsets", + 721: "721. Accounts Merge", 743: "743. Network Delay Time", 778: "778. Swim in Rising Water", "778_desc": "DFS + binary search, there are many similar questions, such as the 1439th question. This kind of question routine is very similar, and the difficulty is not big.", 808: "808. Soup Servings", + 816: "816. Ambiguous Coordinates", + 820: "820. Short Encoding of Words", 837: "837. New 21 Game", + 863: "863. All Nodes Distance K in Binary Tree", 877: "877. Stone Game", 902: "902. Numbers At Most N Given Digit Set", + 904: "904. Fruit Into Baskets", + 912: "912. Sort an Array", + 930: "930. Binary Subarrays With Sum", 935: "935. Knight Dialer(Changed from selecting two directions to selecting eight directions)", + 990: "990. Satisfiability of Equality Equations", + 992: "992. Subarrays with K Different Integers", + 1004: "1004. Max Consecutive Ones III", 1015: "1015. Smallest Integer Divisible by K", + 1032: "1032. Stream of Characters", + 1046: "1046. Last Stone Weight(This question needs to use a large top heap, but they are almost the same)", 1140: "1140. Stone Game II", 1109: "1109. Corporate Flight Bookings", + 1202: "1202. Smallest String With Swaps", + 1234: "1234. Replace the Substring for Balanced String", + 1248: "1248. Count Number of Nice Subarrays", + 1255: "1255. Maximum Score Words Formed by Letters", 1314: "1314. Matrix Block Sum", 1406: "1406. Stone Game III", 1462: "1462. Course Schedule IV", @@ -104,12 +150,17 @@ const en = { 1510: "1510. Stone Game IV", 1563: "1563. Stone Game V", 1584: "1584. Min Cost to Connect All Points", + 1649: "1649. Create Sorted Array through Instructions", 1681: "1681. Minimum Incompatibility", 1686: "1686. Stone Game VI", "1686_desc": "Except for this one, the other \"Stone Game\" ideas are basically the same", 1690: "1690. Stone Game VII", + 1886: "1886. Determine Whether Matrix Can Be Obtained By Rotation", 2536: "2536. Increment Submatrices by One", + 2569: "2569. Handling Sum Queries After Update", + 2736: "2736. Maximum Sum Queries", + 2867: "2867. Number of Valid Paths in a Tree", // https://binarysearch.com/problems minimumLightRadius: "Minimum Light Radius", @@ -157,6 +208,77 @@ const en = { "Prim(also known as adding point method, is a minimum spanning tree algorithm)", item6: "Kahn(topological sorting based on BFS)", }, + binarySearch: { + title: "Binary Search", + item1: "Find a number", + item2: "Find the leftmost value that satisfies the condition", + item3: "Find the rightmost value that satisfies the condition", + item4: "Find the leftmost insertion position", + item5: "Find the rightmost insertion position", + }, + BFS: { + item1: "With layer information", + item2: "Without layer information", + }, + + heap: { + title: "Heap", + item1: "Min Heap", + }, + + slidingWindow: { + title: "Sliding Window", + item1: "Fixed length sliding window", + item2: "Variable length sliding window", + }, + + backtrack: { + title: "Backtrack", + item1: "Standard backtrack", + item2: "Cartesian product optimization", + }, + + trie: { + title: "Trie", + item1: "Standard Trie", + }, + + uf: { + title: "Union Find", + item1: "Union Find without weight", + item2: "Union Find with weight", + }, + + segmentTree: { + title: "Segment Tree", + item1: "Interval and segment tree", + item2: + "Interval sum with lazy propagation (interval update) segment tree", + item3: "Counting segment tree", + item4: "Dynamic allocation of nodes", + }, + + handWriting: { + title: "Hand Writing", + item1: "Sort an array", + item2: "Sort a linked list", + }, + + rotate: { + title: "Rotate", + item1: "Rotate the 2D matrix 90 degrees clockwise.", + }, + + prime: { + title: "Prime", + item1: "Prime screening method", + }, + + suffixArray: { + title: "Suffix Array", + item1: "Standard version", + }, + moreTemplate: "More templates will be updated one after another~", }, dataStructureVisualization: { diff --git a/src/locales/zh.js b/src/locales/zh.js index 2486017..06d2c66 100644 --- a/src/locales/zh.js +++ b/src/locales/zh.js @@ -57,43 +57,89 @@ const zh = { notYet: "暂无", }, problem: { + 3: "3. 无重复字符的最长子串", 10: "10. 正则表达式匹配", + 34: "34. 在排序数组中查找元素的第一个和最后一个位置", + 39: "39. 组合总和", + 40: "40. 组合总和 II", 44: "44. 通配符匹配", + 46: "46. 全排列", + 47: "47. 全排列 II", + 52: "52. N 皇后 II", 62: "62. 不同路径", 63: "63. 不同路径 II", 64: "64. 最小路径和", 69: "69. x 的平方根", 70: "70. 爬楼梯", 72: "72. 编辑距离", + 76: "76. 最小覆盖子串", + 78: "78. 子集", + 90: "90. 子集 II", + 113: "113. 路径总和 II", + 116: "116. 填充每个节点的下一个右侧节点指针", + 131: "131. 分割回文串", + 140: "140. 单词拆分 II", + 148: "148. 排序链表", 174: "174. 地下城游戏", 198: "198. 打家劫舍", + 208: "208. 实现 Trie (前缀树)", + 209: "209. 长度最小的子数组", + 211: "211. 添加与搜索单词 - 数据结构设计", + 212: "212. 单词搜索 II", 233: "233. 数字 1 的个数", 278: "278. 第一个错误的版本", "278_desc": "最左最右思路一样,大家练习两道,实际情况根据题意使用不同的二分即可。", 292: "292. Nim 游戏", + 303: "303. 区域和检索 - 数组不可变(使用一维前缀和会更简单)", + 307: "307. 区域和检索 - 数组可修改", 327: "327. 区间和的个数", 322: "322. 零钱兑换", 337: "337. 打家劫舍 III", 357: "357. 计算各个位数不同的数字个数", + 399: "399. 除法求值", 416: "416. 分割等和子集", + 438: "438. 找到字符串中所有字母异位词", 464: "464. 我能赢吗", + 472: "472. 连接词", 493: "493. 翻转对", + 513: "513. 找树左下角的值", 518: "518. 零钱兑换 II", + 528: "528. 按权重随机选择", + 540: "540. 有序数组中的单一元素", + 547: "547. 朋友圈", 576: "576. 出界的路径数(只能选两个方向变成了只能选四个方向而已)", + 648: "648. 单词替换", + 662: "662. 二叉树最大宽度", 698: "698. 划分为 k 个相等的子集", + 721: "721. 账户合并", 743: "743. 网络延迟时间", 778: "778. 水位上升的泳池中游泳", "778_desc": "DFS + 二分,类似的题目有很多,比如第 1439 题。这种题套路都很像,难度其实也不算大。", 808: "808. 分汤", + 816: "816. 模糊坐标", + 820: "820. 单词的压缩编码", 837: "837. 新21点", + 863: "863. 二叉树中所有距离为 K 的结点", 877: "877. 石子游戏", 902: "902. 最大为 N 的数字组合", + 904: "904. 水果成篮", + 912: "912. 排序数组", + 930: "930. 和相同的二元子数组", 935: "935. 骑士拨号器(只能选两个方向变成了只能选八个方向而已)", + 990: "990. 等式方程的可满足性", + 992: "992. K 个不同整数的子数组", + 1004: "1004. 最大连续 1 的个数 III", 1015: "1015. 可被 K 整除的最小整数", + 1032: "1032. 字符流", + 1046: "1046. 最后一块石头的重量(这道题需要用大顶堆,不过都差不多)", + 1202: "1202. 交换字符串中的元素", 1109: "1109. 航班预订统计", 1140: "1140. 石子游戏 II", + 1234: "1234. 替换子串得到平衡字符串", + 1248: "1248. 统计「优美子数组」", + 1255: "1255. 得分最高的单词集合", 1314: "1314. 矩阵区域和", 1406: "1406. 石子游戏 III", 1462: "1462. 课程表 IV", @@ -101,11 +147,16 @@ const zh = { 1510: "1510. 石子游戏 IV", 1563: "1563. 石子游戏 V", 1584: "1584. 连接所有点的最小费用", + 1649: "1649. 通过指令创建有序数组", 1681: "1681. 最小不兼容性", 1686: "1686. 石子游戏 VI", "1686_desc": "除了这个,其他《石子游戏》思路基本都一样", 1690: "1690. 石子游戏 VII", + 1886: "1886. 判断矩阵经轮转后是否一致", 2536: "2536. 子矩阵元素加 1", + 2569: "2569. 更新数组后处理求和查询", + 2736: "2736. 最大和查询", + 2867: "2867. 统计树中的合法路径数目", // https://binarysearch.com/problems minimumLightRadius: "最小光照半径", @@ -150,6 +201,76 @@ const zh = { item5: "Prim(又称加点法,是一种最小生成树算法)", item6: "Kahn(基于BFS的拓扑排序)", }, + binarySearch: { + title: "二分法", + item1: "查找一个数", + item2: "寻找最左边的满足条件的值", + item3: "寻找最右边的满足条件的值", + item4: "寻找最左插入位置", + item5: "寻找最右插入位置", + + }, + BFS: { + item1: "带层信息", + item2: "不带层信息", + }, + + heap: { + title: "堆", + item1: "小顶堆", + }, + + slidingWindow: { + title: "滑动窗口", + item1: "固定窗口(伪代码)", + item2: "可变窗口(伪代码)", + }, + + backtrack: { + title: "回溯", + item1: "标准回溯(伪代码)", + item2: "笛卡尔积优化", + }, + + trie: { + title: "前缀树", + item1: "标准前缀树", + }, + + uf: { + title: "并查集", + item1: "不带权并查集", + item2: "带权并查集", + }, + + segmentTree: { + title: "线段树", + item1: "区间和线段树", + item2: "区间和懒更新(区间更新)线段树", + item3: "计数线段树", + item4: "动态开点", + }, + + handWriting: { + title: "手撕算法", + item1: "数组排序", + item2: "链表排序", + }, + + rotate: { + title: "矩阵旋转", + item1: "顺时针 90° 旋转二维矩阵", + }, + + prime: { + title: "求质数", + item1: "质数筛选法", + }, + + suffixArray: { + title: "后缀数组", + item1: "标准版", + }, moreTemplate: "更多模板后续陆续更新~", },