Skip to content

Commit c9e4291

Browse files
authored
Merge pull request #40 from rennzhang/feat-lang
fix bug
2 parents 9d764ad + 1e2472e commit c9e4291

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

‎src/locales/en.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -393,35 +393,35 @@ const en = {
393393
394394
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.`,
395395
dp_item1: "Single string type",
396-
dp_item1_keys1: `
397-
State: 1. dp[i] represents the xxxx ending with s[i]
398-
2. dp[i] represents the xxxx up to s[i]`,
396+
dp_item1_keys1: `State:
397+
1. dp[i] represents the xxxx ending with s[i]
398+
2. dp[i] represents the xxxx up to s[i]`,
399399
dp_item1_keys2:
400400
"Enumeration: It usually involves two nested loops, where one loop fixes the left endpoint and the other loop fixes the right endpoint for enumeration.",
401401
dp_item1_keys3:
402402
"Transition equation: Based on the problem, choose whether to combine with s[j], then take the maximum, minimum, or count as required.",
403403

404404
dp_item2: "Double string type",
405-
dp_item2_keys1: `
406-
State: 1. dp[i][j] represents the xxxx ending with s1[i], s2[j]
407-
2. dp[i][j] represents the xxxx up to s1[i], s2[j]`,
405+
dp_item2_keys1: `State:
406+
1. dp[i][j] represents the xxxx ending with s1[i], s2[j]
407+
2. dp[i][j] represents the xxxx up to s1[i], s2[j]`,
408408
dp_item2_keys2:
409409
"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.",
410410
dp_item2_keys3:
411411
"State transition: Based on the problem and the relationship between s[i] and s[j], take the maximum, minimum, or count as required.",
412412

413413
dp_item3: "Sequence type",
414-
dp_item3_keys1: `
415-
State: 1. In one-dimensional arrays, dp[i] usually represents the xxxx ending with nums[i]
416-
2. In two-dimensional arrays, dp[i][j] usually represents the xxxx ending with grid[i][j]`,
414+
dp_item3_keys1: `State:
415+
1. In one-dimensional arrays, dp[i] usually represents the xxxx ending with nums[i]
416+
2. In two-dimensional arrays, dp[i][j] usually represents the xxxx ending with grid[i][j]`,
417417
dp_item3_keys2:
418418
"Enumeration: One-dimensional involves a single loop to enumerate all nums, while two-dimensional involves two loops to enumerate all grid.",
419-
dp_item3_keys3: `
420-
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.
421-
dp[i] = dp[i - 1] + dp[i - 2]" This is also called a recurrence relation because it does not involve decision-making.
422-
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.
423-
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.
424-
3. From the transition equation, it's not difficult to see that this type of problem can usually be optimized using rolling arrays.
419+
dp_item3_keys3: `State transition:
420+
1. In one dimension, it usually involves the relationship between the current cell and the preceding two cells, possibly involving maximum, minimum, or counting.
421+
dp[i] = dp[i - 1] + dp[i - 2]" This is also called a recurrence relation because it does not involve decision-making.
422+
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.
423+
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.
424+
3. From the transition equation, it's not difficult to see that this type of problem can usually be optimized using rolling arrays.
425425
`,
426426

427427
dp_item4: "Backpack type(List only the problems)",

‎src/locales/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export const setLang = (_lang) => {
3232
export const initLang = async (currentUrl) => {
3333
if (isInit) return;
3434

35-
const isCnHref = currentUrl.includes(LEETCODE_CN_URL);
36-
setLang(isCnHref ? "zh" : "en");
35+
const isEnHref = currentUrl.includes(LEETCODE_URL);
36+
setLang(isEnHref ? "en":"zh");
3737
isInit = true;
3838
};
3939

‎src/locales/zh.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ const zh = {
385385
当然这个学习路线是给有一些基础的人看的,如果你还没有基础,可以看下相关文章,之后我也会写一篇硬核套路文。
386386
`,
387387
dp_item1: "单字符串型",
388-
dp_item1_keys1: `
389-
状态:1. dp[i] 表示以 s[i] 结尾的 xxxx
390-
2. dp[i] 表示到 s[i] 为止的 xxxx
388+
dp_item1_keys1: `状态:
389+
1. dp[i] 表示以 s[i] 结尾的 xxxx
390+
2. dp[i] 表示到 s[i] 为止的 xxxx
391391
`,
392392

393393
dp_item1_keys2:
@@ -396,28 +396,28 @@ const zh = {
396396
"转移方程:根据题目选择是否和 s[j] 结合,取最大,最小或计数即可",
397397

398398
dp_item2: "双字符串型",
399-
dp_item2_keys1: `
400-
状态:1. dp[i][j] 表示以 s1[i],s2[j] 结尾的 xxxx
401-
2. dp[i][j] 表示到 s1[i],s2[j] 为止的 xxxx
399+
dp_item2_keys1: `状态:
400+
1. dp[i][j] 表示以 s1[i],s2[j] 结尾的 xxxx
401+
2. dp[i][j] 表示到 s1[i],s2[j] 为止的 xxxx
402402
`,
403403
dp_item2_keys2:
404404
"枚举:通常都是两层循环,一层循环固定 s1 的右端点,另一层循环固定 s2 的右端点进行枚举",
405405
dp_item2_keys3:
406406
"状态转移:根据题目以及 s[i], s[j] 的关系,取最大,最小或计数即可",
407407

408408
dp_item3: "爬楼梯型",
409-
dp_item3_keys1: `
410-
状态:1. 一维通常是 dp[i] 表示以 nums[i] 结尾的 xxxx
411-
2. 二维通常是 dp[i][j] 表示以 grid[i][j] 结尾的 xxxx
409+
dp_item3_keys1: `状态:
410+
1. 一维通常是 dp[i] 表示以 nums[i] 结尾的 xxxx
411+
2. 二维通常是 dp[i][j] 表示以 grid[i][j] 结尾的 xxxx
412412
`,
413413
dp_item3_keys2:
414414
"枚举:一维就是一层循环枚举所有的 nums,二维就是两层循环枚举所有的 grid",
415-
dp_item3_keys3: `
416-
状态转移:1. 一维通常是当前格子和前面的两个格子的关系,可能是最大最小或计数。
417-
dp[i] = dp[i - 1] + dp[i - 2],这也叫递推式,因为不涉及决策。
418-
2. 二维通常是当前格子和上方以及左方的两个格子的关系,可能是最大最小或计数。
419-
dp[i][j] = dp[i - 1][j] + dp[i][j-1],这也叫递推式,因为不涉及决策。
420-
3. 根转移方程不难看出, 这种题目通常都可以滚动数组优化
415+
dp_item3_keys3: `状态转移:
416+
1. 一维通常是当前格子和前面的两个格子的关系,可能是最大最小或计数。
417+
dp[i] = dp[i - 1] + dp[i - 2],这也叫递推式,因为不涉及决策。
418+
2. 二维通常是当前格子和上方以及左方的两个格子的关系,可能是最大最小或计数。
419+
dp[i][j] = dp[i - 1][j] + dp[i][j-1],这也叫递推式,因为不涉及决策。
420+
3. 根转移方程不难看出, 这种题目通常都可以滚动数组优化
421421
`,
422422

423423
dp_item4: "背包型(仅列举题目)",

‎src/roadmap/roadmap.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,14 @@ export default function RoadMap() {
567567
</Radio.Button>
568568
</Radio.Group>
569569
<div>
570-
<pre>{roadmaps[topic].desc}</pre>
570+
<pre style={{whiteSpace: "pre-wrap"}}>{roadmaps[topic].desc}</pre>
571571
{roadmaps[topic].items.map((item) => {
572572
return (
573573
<div key={item.title}>
574574
<h1>{item.title}</h1>
575575
<div>
576576
{item.keys.map((key) => (
577-
<pre key={key}>{key}</pre>
577+
<pre style={{whiteSpace: "pre-wrap"}} key={key}>{key}</pre>
578578
))}
579579
</div>
580580
{item.pic && (
@@ -583,9 +583,9 @@ export default function RoadMap() {
583583
({t("Locale.learningRoute.clickToEnlarge")})
584584
</>
585585
)}
586-
{item.code && <Codes codes={[item.code]}></Codes>}
586+
{item.code && <Codes codes={[item.code]} ></Codes>}
587587
{ t("Locale.learningRoute.recommendedProblems")}
588-
<ul>
588+
<ul >
589589
{item.problems.map(({ link, text, desc }) => {
590590
return (
591591
<li key={text}>

0 commit comments

Comments
 (0)