Skip to content

Commit 5941680

Browse files
authored
Merge pull request #36 from rennzhang/feat-lang
2 parents d10f05b + 7b8f357 commit 5941680

File tree

3 files changed

+483
-155
lines changed

3 files changed

+483
-155
lines changed

src/locales/en.js

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,81 @@ const en = {
6060
notYet: "Not yet",
6161
},
6262
problem: {
63+
10: "10. Regular Expression Matching",
64+
44: "44. Wildcard Matching",
65+
62: "62. Unique Paths",
66+
63: "63. Unique Paths II",
67+
64: "64. Minimum Path Sum",
68+
69: "69. Sqrt(x)",
69+
70: "70. Climbing Stairs",
70+
72: "72. Edit Distance",
71+
174: "174. Dungeon Game",
72+
198: "198. House Robber",
73+
233: "233. Number of Digit One",
74+
278: "278. First Bad Version",
75+
"278_desc":
76+
"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.",
77+
292: "292. Nim Game",
78+
327: "327. Count of Range Sum",
79+
322: "322. Coin Change",
80+
337: "337. House Robber III",
81+
357: "357. Count Numbers with Unique Digits",
82+
416: "416. Partition Equal Subset Sum",
83+
464: "464. Can I Win",
84+
493: "493. Reverse Pairs",
85+
518: "518. Coin Change 2",
86+
576: "576. Out of Boundary Paths(changed from selecting two directions to selecting four directions)",
87+
698: "698. Partition to K Equal Sum Subsets",
6388
743: "743. Network Delay Time",
89+
778: "778. Swim in Rising Water",
90+
"778_desc":
91+
"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.",
92+
808: "808. Soup Servings",
93+
837: "837. New 21 Game",
94+
877: "877. Stone Game",
95+
902: "902. Numbers At Most N Given Digit Set",
96+
935: "935. Knight Dialer(Changed from selecting two directions to selecting eight directions)",
97+
1015: "1015. Smallest Integer Divisible by K",
98+
1140: "1140. Stone Game II",
6499
1109: "1109. Corporate Flight Bookings",
65100
1314: "1314. Matrix Block Sum",
101+
1406: "1406. Stone Game III",
66102
1462: "1462. Course Schedule IV",
67103
1480: "1480. Running Sum of 1d Array",
104+
1510: "1510. Stone Game IV",
105+
1563: "1563. Stone Game V",
68106
1584: "1584. Min Cost to Connect All Points",
107+
1681: "1681. Minimum Incompatibility",
108+
1686: "1686. Stone Game VI",
109+
"1686_desc":
110+
"Except for this one, the other \"Stone Game\" ideas are basically the same",
111+
1690: "1690. Stone Game VII",
69112
2536: "2536. Increment Submatrices by One",
113+
114+
// https://binarysearch.com/problems
115+
minimumLightRadius: "Minimum Light Radius",
116+
minimumLightRadius_desc:
117+
"Classic ability detection binary search, leetcode also has a similar topic",
118+
kthPairDistance: "Kth Smallest Distance Pair",
119+
kthPairDistance_desc:
120+
"Typical counting binary search, which is essentially an ability test, but the number of questions is large, so it is separated.",
121+
increasingDigits: "Increasing Digits",
122+
palindromicInsertions: "Palindromic Insertions",
123+
palindromicInsertions_desc:
124+
"For interval dynamic programming, it is necessary to proceed simultaneously from both ends of the sequence, rather than from one end of the sequence to the other.",
125+
126+
// 剑指 Offer 系列
127+
JZ51: "Sword Offer 51. Reverse pairs in an array",
128+
129+
// 面试题系列
130+
interview17_13: "Interview 17.13. Re-Space LCCI",
131+
interview17_13__desc:
132+
"CHow to practice the details? 1? - 1? How to initialize? You can learn through this question ~",
133+
134+
longestIncreasingSubsequence: "Longest Increasing Subsequence Series",
135+
longestIncreasingSubsequence_desc: "Series classic topic, worth doing",
136+
littleRabbitsChessboard: "Little Rabbit's Chessboard",
137+
shopeesOffice: "Shopee's Office",
70138
},
71139
codeTemplate: {
72140
name: "Code Template",
@@ -137,6 +205,98 @@ const en = {
137205
},
138206
learningRoute: {
139207
name: "Learning Route",
208+
binarySearch: "Binary Search",
209+
binarySearchDesc: `
210+
If you ask me to summarize binary search in one sentence, I would say that binary search is an algorithm that makes the unknown world inorganic. That is, no matter what, we can discard half of the solutions, that is, we can cut the solution space in half.
211+
The difficulty is two points: **what conditions** and **which part to discard**. This is the core problem that binary search needs to solve.
212+
213+
There are two basic types of tactics, namely the leftmost insertion binary search and the rightmost insertion binary search.
214+
215+
There are four basic types of strategies: ability detection binary search, prefix sum binary search, insertion sort binary search, and counting binary search.
216+
217+
These two parts are very practical. While understanding these two parts, please keep in mind a central point **half**.
218+
219+
For more information, please visit: https://lucifer.ren/blog/2021/03/08/binary-search-1`,
220+
binarySearch_item1: "Leftmost/Rightmost Binary Search",
221+
binarySearch_item1_text: "Code reference: Code templates - Binary",
222+
binarySearch_item1_keys: `
223+
1. shrink the right boundary continuously and finally return the left boundary
224+
2. shrink the left boundary continuously and finally return the right boundary
225+
`,
226+
binarySearch_item2: "Ability Detection Binary Search",
227+
binarySearch_item2_keys: `Define the function that the possible argument is mid and the return value is a Boolean value. The outer layer adjusts according to the return value "; Solution space" . The sample code is an example of the leftmost binary.
228+
`,
229+
binarySearch_item3: "Prefix Sum Binary Search",
230+
binarySearch_item3_keys: `
231+
If the array is non-negative, then the prefix sum is a monotone non-decrement array, and we can sometimes make dichotomies based on it.
232+
`,
233+
binarySearch_item4: "Insertion Sort Binary Search",
234+
binarySearch_item4_keys: `
235+
Continuously insert and maintain the ordered sequence, and then use the ordered sequence to do something.
236+
`,
237+
binarySearch_item5: "Counting Binary Search",
238+
binarySearch_item5_keys: `The essence is also ability detection, so it is basically the same as the ability detection framework. Everyone compares and understands.
239+
`,
240+
241+
dp: "Dynamic Programming",
242+
dp_desc: `The basic framework for different problems of the same type is generally consistent, but with slight variations in details. The template code is explained using a specific type as an example, and individuals should make adjustments based on the actual situation.
243+
244+
The three key points for dynamic programming are: state, enumeration, and transition equations (choices). For each type of problem, I try to provide hints based on these three points.
245+
246+
Of course, this learning path is intended for those with some foundation. If you don't have a foundation yet, you can refer to related articles. I will also write a comprehensive routine article in the future.`,
247+
dp_item1: "Single string type",
248+
dp_item1_keys1: `
249+
State: 1. dp[i] represents the xxxx ending with s[i]
250+
2. dp[i] represents the xxxx up to s[i]`,
251+
dp_item1_keys2:
252+
"Enumeration: It usually involves two nested loops, where one loop fixes the left endpoint and the other loop fixes the right endpoint for enumeration.",
253+
dp_item1_keys3:
254+
"Transition equation: Based on the problem, choose whether to combine with s[j], then take the maximum, minimum, or count as required.",
255+
256+
dp_item2: "Double string type",
257+
dp_item2_keys1: `
258+
State: 1. dp[i][j] represents the xxxx ending with s1[i], s2[j]
259+
2. dp[i][j] represents the xxxx up to s1[i], s2[j]`,
260+
dp_item2_keys2:
261+
"Enumeration: Typically, it involves two nested loops, where one loop fixes the right endpoint of s1, and the other loop fixes the right endpoint of s2 for enumeration.",
262+
dp_item2_keys3:
263+
"State transition: Based on the problem and the relationship between s[i] and s[j], take the maximum, minimum, or count as required.",
264+
265+
dp_item3: "Sequence type",
266+
dp_item3_keys1: `
267+
State: 1. In one-dimensional arrays, dp[i] usually represents the xxxx ending with nums[i]
268+
2. In two-dimensional arrays, dp[i][j] usually represents the xxxx ending with grid[i][j]`,
269+
dp_item3_keys2:
270+
"Enumeration: One-dimensional involves a single loop to enumerate all nums, while two-dimensional involves two loops to enumerate all grid.",
271+
dp_item3_keys3: `
272+
State transition: 1. In one dimension, it usually involves the relationship between the current cell and the preceding two cells, possibly involving maximum, minimum, or counting.
273+
dp[i] = dp[i - 1] + dp[i - 2]" This is also called a recurrence relation because it does not involve decision-making.
274+
2. In two dimensions, it usually involves the relationship between the current cell and its upper and left adjacent cells, possibly involving maximum, minimum, or counting.
275+
dp[i][j] = dp[i - 1][j] + dp[i][j-1]" This is also called a recurrence relation because it does not involve decision-making.
276+
3. From the transition equation, it's not difficult to see that this type of problem can usually be optimized using rolling arrays.
277+
`,
278+
279+
dp_item4: "Backpack type(List only the problems)",
280+
dp_item5: "Number type(List only the problems)",
281+
dp_item5_keys1:
282+
"The common definition of dynamic programming is represented as dp[i][j], where i stands for the length of the number, and j represents the last digit. For example, dp[3][2] denotes a number with a total of three digits, with 2 as the last digit.",
283+
dp_item6: "Probability type(List only the problems)",
284+
dp_item7: "Game type(List only the problems)",
285+
286+
dp_item8: "Interval DP",
287+
dp_item8_text_comment:
288+
"Using memoization might lead to better code writing. For example, the above DP code can be transformed into memoized recursion as:",
289+
dp_item8_keys1: `
290+
Traversing in reverse from the right boundary and in forward from the left boundary
291+
`,
292+
dp_item8_keys2:
293+
"Typically, the return value is dp[0][n], rather than other common dp[-1][-1].",
294+
dp_item9: "State compression type(List only the problems)",
295+
296+
tree: "Tree",
297+
linkedList: "Linked List",
298+
clickToEnlarge: "Click to enlarge",
299+
recommendedProblems: "Recommended Problems",
140300
},
141301
checkForUpdates: {
142302
name: "Check for Updates",

src/locales/zh.js

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,79 @@ const zh = {
5757
notYet: "暂无",
5858
},
5959
problem: {
60+
10: "10. 正则表达式匹配",
61+
44: "44. 通配符匹配",
62+
62: "62. 不同路径",
63+
63: "63. 不同路径 II",
64+
64: "64. 最小路径和",
65+
69: "69. x 的平方根",
66+
70: "70. 爬楼梯",
67+
72: "72. 编辑距离",
68+
174: "174. 地下城游戏",
69+
198: "198. 打家劫舍",
70+
233: "233. 数字 1 的个数",
71+
278: "278. 第一个错误的版本",
72+
"278_desc":
73+
"最左最右思路一样,大家练习两道,实际情况根据题意使用不同的二分即可。",
74+
292: "292. Nim 游戏",
75+
327: "327. 区间和的个数",
76+
322: "322. 零钱兑换",
77+
337: "337. 打家劫舍 III",
78+
357: "357. 计算各个位数不同的数字个数",
79+
416: "416. 分割等和子集",
80+
464: "464. 我能赢吗",
81+
493: "493. 翻转对",
82+
518: "518. 零钱兑换 II",
83+
576: "576. 出界的路径数(只能选两个方向变成了只能选四个方向而已)",
84+
698: "698. 划分为 k 个相等的子集",
6085
743: "743. 网络延迟时间",
86+
778: "778. 水位上升的泳池中游泳",
87+
"778_desc":
88+
"DFS + 二分,类似的题目有很多,比如第 1439 题。这种题套路都很像,难度其实也不算大。",
89+
808: "808. 分汤",
90+
837: "837. 新21点",
91+
877: "877. 石子游戏",
92+
902: "902. 最大为 N 的数字组合",
93+
935: "935. 骑士拨号器(只能选两个方向变成了只能选八个方向而已)",
94+
1015: "1015. 可被 K 整除的最小整数",
6195
1109: "1109. 航班预订统计",
96+
1140: "1140. 石子游戏 II",
6297
1314: "1314. 矩阵区域和",
98+
1406: "1406. 石子游戏 III",
6399
1462: "1462. 课程表 IV",
64100
1480: "1480. 一维数组的动态和",
101+
1510: "1510. 石子游戏 IV",
102+
1563: "1563. 石子游戏 V",
65103
1584: "1584. 连接所有点的最小费用",
104+
1681: "1681. 最小不兼容性",
105+
1686: "1686. 石子游戏 VI",
106+
"1686_desc": "除了这个,其他《石子游戏》思路基本都一样",
107+
1690: "1690. 石子游戏 VII",
66108
2536: "2536. 子矩阵元素加 1",
109+
110+
// https://binarysearch.com/problems
111+
minimumLightRadius: "最小光照半径",
112+
minimumLightRadius_desc: "经典能力检测二分,力扣也有一道类似题",
113+
kthPairDistance: "第 K 小的距离对",
114+
kthPairDistance_desc:
115+
"典型的计数二分,本质上也是能力检测,只不过题量大,单独拆出来。",
116+
increasingDigits: "递增的数位",
117+
palindromicInsertions: "回文插入",
118+
palindromicInsertions_desc:
119+
"区间 dp 需要从序列两头同时进行,而不是从序列的某一端到另一端",
120+
121+
// 剑指 Offer 系列
122+
JZ51: "剑指 Offer 51. 数组中的逆序对",
123+
124+
// 面试题系列
125+
interview17_13: "面试题 17.13. 恢复空格",
126+
interview17_13__desc:
127+
"细节怎么练?+1? -1? 怎么初始化?大家可以通过这道题学习一下~",
128+
129+
longestIncreasingSubsequence: "最长上升子序列系列",
130+
longestIncreasingSubsequence_desc: "系列经典题目,值得一做",
131+
littleRabbitsChessboard: "小兔的棋盘",
132+
shopeesOffice: "Shopee 的办公室",
67133
},
68134
codeTemplate: {
69135
name: "代码模板",
@@ -130,6 +196,106 @@ const zh = {
130196
},
131197
learningRoute: {
132198
name: "学习路线",
199+
binarySearch: "二分查找",
200+
binarySearchDesc: `
201+
如果让我用一句话总结二分法,我会说**二分法是一种让未知世界无机可乘的算法**。即二分法无论如何我们都可以舍弃一半解,也就是无论如何都可以将解空间砍半。
202+
难点就是两点:**什么条件** 和 **舍弃哪部分**。这是二分法核心要解决的问题。
203+
204+
从战术上有两种基本类型,分别是最左插入二分和最右插入二分。
205+
206+
从战略上有四种基本类型,能力检测二分,前缀和二分,插入排序二分和计数二分。
207+
208+
两种类型(最左和最右插入)主要解决的的是:**解空间已经明确出来了,如何用代码找出具体的解**。而四大应用主要解决的是:**如何构造解空间**。更多的情况则是如何构建有序序列。
209+
210+
这两部分都是实操性很强的内容,在理解这两部分内容的同时,请大家务必牢记一个中心**折半**。
211+
212+
更多内容请访问:https://lucifer.ren/blog/2021/03/08/binary-search-1`,
213+
binarySearch_item1: "最左/最右二分",
214+
binarySearch_item1_text: "代码参考:代码模板 - 二分法",
215+
binarySearch_item1_keys: `
216+
1. 最左二分不断收缩右边界,最终返回左边界
217+
2. 最右二分不断收缩左边界,最终返回右边界
218+
`,
219+
binarySearch_item2: "能力检测二分",
220+
binarySearch_item2_keys: `定义函数 possible 参数是 mid,返回值是布尔值。外层根据返回值调整"解空间"。示例代码是以最左二分为例的。
221+
`,
222+
binarySearch_item3: "前缀和二分",
223+
binarySearch_item3_keys: `
224+
如果数组是非负的,那么前缀和就是一个单调不递减数组,我们有时候可以基于它来做二分。
225+
`,
226+
binarySearch_item4: "插入排序二分",
227+
binarySearch_item4_keys: `
228+
不断插入并维护序列有序,进而利用有序做一些事情。
229+
`,
230+
binarySearch_item5: "计数二分",
231+
binarySearch_item5_keys: `本质也是能力检测,因此和能力检测框架基本一致,大家对比理解一下。
232+
`,
233+
234+
dp: "动态规划",
235+
dp_desc: `
236+
同一类型的不同题目框架基本一致,但细节略有不同,模板代码仅以某一种为例进行讲述,大家根据实际情况微调。
237+
238+
动态规划三把斧:状态,枚举,转移方程(选择)。对于每一种题目,我都尽量按照这三点给大家提示。
239+
240+
当然这个学习路线是给有一些基础的人看的,如果你还没有基础,可以看下相关文章,之后我也会写一篇硬核套路文。
241+
`,
242+
dp_item1: "单字符串型",
243+
dp_item1_keys1: `
244+
状态:1. dp[i] 表示以 s[i] 结尾的 xxxx
245+
2. dp[i] 表示到 s[i] 为止的 xxxx
246+
`,
247+
248+
dp_item1_keys2:
249+
"枚举:通常都是两层循环,一层循环固定左端点,另一层循环固定右端点进行枚举",
250+
dp_item1_keys3:
251+
"转移方程:根据题目选择是否和 s[j] 结合,取最大,最小或计数即可",
252+
253+
dp_item2: "双字符串型",
254+
dp_item2_keys1: `
255+
状态:1. dp[i][j] 表示以 s1[i],s2[j] 结尾的 xxxx
256+
2. dp[i][j] 表示到 s1[i],s2[j] 为止的 xxxx
257+
`,
258+
dp_item2_keys2:
259+
"枚举:通常都是两层循环,一层循环固定 s1 的右端点,另一层循环固定 s2 的右端点进行枚举",
260+
dp_item2_keys3:
261+
"状态转移:根据题目以及 s[i], s[j] 的关系,取最大,最小或计数即可",
262+
263+
dp_item3: "爬楼梯型",
264+
dp_item3_keys1: `
265+
状态:1. 一维通常是 dp[i] 表示以 nums[i] 结尾的 xxxx
266+
2. 二维通常是 dp[i][j] 表示以 grid[i][j] 结尾的 xxxx
267+
`,
268+
dp_item3_keys2:
269+
"枚举:一维就是一层循环枚举所有的 nums,二维就是两层循环枚举所有的 grid",
270+
dp_item3_keys3: `
271+
状态转移:1. 一维通常是当前格子和前面的两个格子的关系,可能是最大最小或计数。
272+
dp[i] = dp[i - 1] + dp[i - 2],这也叫递推式,因为不涉及决策。
273+
2. 二维通常是当前格子和上方以及左方的两个格子的关系,可能是最大最小或计数。
274+
dp[i][j] = dp[i - 1][j] + dp[i][j-1],这也叫递推式,因为不涉及决策。
275+
3. 根转移方程不难看出, 这种题目通常都可以滚动数组优化
276+
`,
277+
278+
dp_item4: "背包型(仅列举题目)",
279+
dp_item5: "数位型(仅列举题目)",
280+
dp_item5_keys1:
281+
"常见的 dp 定义为 dp[i][j] 其中 i 为数字的长度, j 为最后一位的数。比如 dp[3][2] 表示这个数一共三位,最后一位是 2 的情况",
282+
283+
dp_item6: "概率型(仅列举题目)",
284+
dp_item7: "博弈型(仅列举题目)",
285+
286+
dp_item8: "区间 DP",
287+
dp_item8_text_comment:
288+
"使用记忆化可能会更好书写,比如上面的 dp 代码改成记忆化递归就是:",
289+
dp_item8_keys1: `
290+
右边界倒序遍历,左边界正序遍历
291+
`,
292+
dp_item8_keys2: "通常都是返回 dp[0][n],而不是其他常见的 dp[-1][-1]",
293+
dp_item9: "状态压缩型(仅列举题目)",
294+
295+
tree: "树",
296+
linkedList: "链表",
297+
clickToEnlarge: "单击可放大",
298+
recommendedProblems: "推荐题目",
133299
},
134300
checkForUpdates: {
135301
name: "检查更新",

0 commit comments

Comments
 (0)