From cfe17710d691abf971529f22c5187183d6b0f68f Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Tue, 31 Oct 2023 17:50:22 +0800 Subject: [PATCH 1/8] style: code optimization --- leetcode-docs/easy/13-roman-to-int.mdx | 1 - .../easy/14-longest-common-prefix.mdx | 14 +++-- leetcode-docs/easy/20-is-valid.mdx | 2 +- leetcode-docs/hard/23-merge-k-lists.mdx | 1 + leetcode-docs/hard/76-min-window.mdx | 59 +++++++------------ leetcode-docs/medium/12-int-to-roman.mdx | 6 +- .../medium/3-length-of-longest-substring.mdx | 25 ++++---- leetcode-docs/medium/6-convert.mdx | 6 +- leetcode-docs/medium/7-reverse.mdx | 1 + src/leetcode/rust/src/easy/question_14.rs | 2 + src/leetcode/rust/src/main.rs | 6 +- 11 files changed, 55 insertions(+), 68 deletions(-) diff --git a/leetcode-docs/easy/13-roman-to-int.mdx b/leetcode-docs/easy/13-roman-to-int.mdx index dd8586a4..6ac1c1e3 100644 --- a/leetcode-docs/easy/13-roman-to-int.mdx +++ b/leetcode-docs/easy/13-roman-to-int.mdx @@ -115,7 +115,6 @@ pub fn roman_to_int(s: String) -> i32 { }) .0 } - ``` diff --git a/leetcode-docs/easy/14-longest-common-prefix.mdx b/leetcode-docs/easy/14-longest-common-prefix.mdx index da5efada..056309c0 100644 --- a/leetcode-docs/easy/14-longest-common-prefix.mdx +++ b/leetcode-docs/easy/14-longest-common-prefix.mdx @@ -25,8 +25,7 @@ sidebar_label: 14. 最长公共前缀 ## 题解 -先假设第一个单词为 `prefix`, 如果 `strs` 里所有单词的前缀都是 `prefix`, 那就返回之; -否则将 `prefix` 的最后一位删掉继续循环, 直到找出前缀. +先假设第一个单词为 `prefix`, 如果 `strs` 里所有单词的前缀都是 `prefix`, 那就返回之; 否则将 `prefix` 的最后一位删掉继续循环, 直到找出前缀. import Tabs from '@theme/Tabs' import TabItem from '@theme/TabItem' @@ -40,13 +39,14 @@ import TabItem from '@theme/TabItem' * @return {string} */ var longestCommonPrefix = function (strs) { + strs.sort((a, b) => a.length - b.length) let prefix = strs[0] - let hasFound = false + let flag = false - while (!hasFound) { - hasFound = strs.every((str) => str.startsWith(prefix)) + while (!flag) { + flag = strs.every((str) => str.startsWith(prefix)) - if (!hasFound) { + if (!flag) { prefix = prefix.slice(0, -1) } } @@ -60,6 +60,8 @@ var longestCommonPrefix = function (strs) { ```rust pub fn longest_common_prefix(strs: Vec) -> String { + let mut strs = strs; + strs.sort(); let mut prefix: &str = &strs[0]; let mut has_found = false; diff --git a/leetcode-docs/easy/20-is-valid.mdx b/leetcode-docs/easy/20-is-valid.mdx index 75a7f8e2..b74e26b1 100644 --- a/leetcode-docs/easy/20-is-valid.mdx +++ b/leetcode-docs/easy/20-is-valid.mdx @@ -57,7 +57,7 @@ var isValid = function (s) { const n = s.length // 如果是奇数, 一定不是合法的括号 - if (n % 2 == 1) return false + if (n % 2 === 1) return false const stack = [] diff --git a/leetcode-docs/hard/23-merge-k-lists.mdx b/leetcode-docs/hard/23-merge-k-lists.mdx index 818c6e91..8a1894dc 100644 --- a/leetcode-docs/hard/23-merge-k-lists.mdx +++ b/leetcode-docs/hard/23-merge-k-lists.mdx @@ -125,6 +125,7 @@ var mergeKLists = function (lists) { * @param {ListNode} l2 * @return {ListNode} */ +// 这个就是 21 题原题 var mergeTwoLists = function (l1, l2) { const dummy = new ListNode(-1) let curr = dummy diff --git a/leetcode-docs/hard/76-min-window.mdx b/leetcode-docs/hard/76-min-window.mdx index 9eecb731..0a4b1ba5 100644 --- a/leetcode-docs/hard/76-min-window.mdx +++ b/leetcode-docs/hard/76-min-window.mdx @@ -65,59 +65,42 @@ import TabItem from '@theme/TabItem' * @return {string} */ var minWindow = function (s, t) { - let res = '' + let minStr = '' const needMap = new Map() - for (const letter of t) { - if (needMap.has(letter)) { - needMap.set(letter, needMap.get(letter) + 1) - } else { - needMap.set(letter, 1) - } + for (const ch of t) { + needMap.set(ch, needMap.has(ch) ? needMap.get(ch) + 1 : 1) } + const windowMap = new Map() let start = 0 let end = 0 let count = 0 - while (end < sLen) { - const endLetter = s[end] - end++ - - if (needMap.has(endLetter)) { - if (windowMap.has(endLetter)) { - windowMap.set(endLetter, windowMap.get(endLetter) + 1) - } else { - windowMap.set(endLetter, 1) - } + while (end < s.length) { + const endCh = s[end++] - if (needMap.get(endLetter) === windowMap.get(endLetter)) { - count++ - } + if (needMap.has(endCh)) { + windowMap.set(endCh, windowMap.has(endCh) ? windowMap.get(endCh) + 1 : 1) + if (needMap.get(endCh) === windowMap.get(endCh)) count++ } // 当 count === needMap.size, 说明找到了一个覆盖子串 // 这个时候就可以收缩窗口了 while (count === needMap.size) { - const window = s.slice(start, end) - if (res.length === 0 || window.length < res.length) { - res = window - } - - const startLetter = s[start] - start++ + const subStr = s.slice(start, end) + if (minStr.length === 0 || subStr.length < minStr.length) minStr = subStr - if (needMap.has(startLetter)) { - if (needMap.get(startLetter) === windowMap.get(startLetter)) { - count-- - } + const startCh = s[start++] - windowMap.set(startLetter, windowMap.get(startLetter) - 1) + if (needMap.has(startCh)) { + if (needMap.get(startCh) === windowMap.get(startCh)) count-- + windowMap.set(startCh, windowMap.get(startCh) - 1) } } } - return res + return minStr } ``` @@ -128,7 +111,7 @@ var minWindow = function (s, t) { use std::collections::HashMap; pub fn min_window(s: String, t: String) -> String { - let mut res = ""; + let mut min_str = ""; let mut need_map = HashMap::new(); for letter in t.as_bytes() { @@ -152,9 +135,9 @@ pub fn min_window(s: String, t: String) -> String { } while count == need_map.len() { - let window = &s[start..end]; - if res.len() == 0 || window.len() < res.len() { - res = window; + let sub_str = &s[start..end]; + if min_str.len() == 0 || sub_str.len() < min_str.len() { + min_str = sub_str; } let start_letter = s.as_bytes()[start]; @@ -170,7 +153,7 @@ pub fn min_window(s: String, t: String) -> String { } } - res.to_string() + min_str.to_string() } ``` diff --git a/leetcode-docs/medium/12-int-to-roman.mdx b/leetcode-docs/medium/12-int-to-roman.mdx index 47f6bcd5..b532841e 100644 --- a/leetcode-docs/medium/12-int-to-roman.mdx +++ b/leetcode-docs/medium/12-int-to-roman.mdx @@ -54,13 +54,13 @@ sidebar_label: 12. 整数转罗马数字 ```ts 输入: num = 58 输出: 'LVIII' -解释: L = 50, V = 5, III = 3. +解释: (L = 50), (V = 5), (III = 3) ``` ```ts 输入: num = 1994 输出: 'MCMXCIV' -解释: M = 1000, CM = 900, XC = 90, IV = 4. +解释: (M = 1000), (CM = 900), (XC = 90), (IV = 4) ``` ::: @@ -81,7 +81,6 @@ import TabItem from '@theme/TabItem' * @return {string} */ var intToRoman = function (num) { - let roman = '' const map = [ [1000, 'M'], [900, 'CM'], @@ -98,6 +97,7 @@ var intToRoman = function (num) { [1, 'I'], ] + let roman = '' for (const [value, symbol] of map) { while (num >= value) { num -= value diff --git a/leetcode-docs/medium/3-length-of-longest-substring.mdx b/leetcode-docs/medium/3-length-of-longest-substring.mdx index 6803d950..bae6cb0d 100644 --- a/leetcode-docs/medium/3-length-of-longest-substring.mdx +++ b/leetcode-docs/medium/3-length-of-longest-substring.mdx @@ -88,17 +88,12 @@ var lengthOfLongestSubstring = function (s) { let max = 0 while (end < n) { - const endChar = s[end++] + const endCh = s[end++] + map.set(endCh, map.has(endCh) ? map.get(endCh) + 1 : 1) - if (map.has(endChar)) { - map.set(endChar, map.get(endChar) + 1) - } else { - map.set(endChar, 1) - } - - while (map.get(endChar) > 1) { - const startChar = s[start++] - map.set(startChar, map.get(startChar) - 1) + while (map.get(endCh) > 1) { + const startCh = s[start++] + map.set(startCh, map.get(startCh) - 1) } max = Math.max(max, end - start) @@ -123,14 +118,14 @@ pub fn length_of_longest_substring(s: String) -> i32 { let mut end = 0; while end < s.len() { - let end_char = s_bytes[end]; + let end_ch = s_bytes[end]; end += 1; - map.entry(end_char).and_modify(|e| *e += 1).or_insert(1); + map.entry(end_ch).and_modify(|e| *e += 1).or_insert(1); - while map[&end_char] > 1 { - let start_char = s_bytes[start]; + while map[&end_ch] > 1 { + let start_ch = s_bytes[start]; start += 1; - map.entry(start_char).and_modify(|e| *e -= 1); + map.entry(start_ch).and_modify(|e| *e -= 1); } max = cmp::max(end - start, max); diff --git a/leetcode-docs/medium/6-convert.mdx b/leetcode-docs/medium/6-convert.mdx index 800394a9..737c2c0a 100644 --- a/leetcode-docs/medium/6-convert.mdx +++ b/leetcode-docs/medium/6-convert.mdx @@ -74,11 +74,11 @@ import TabItem from '@theme/TabItem' * @return {string} */ var convert = function (s, numRows) { - const n = s.length - // 如果 numRows 比 2 小, 是没法变成 Z 型的, 直接返回 s 即可 if (numRows < 2) return s + const n = s.length + // 初始化一个数组, 数组长度为 numRows const res = Array(numRows).fill('') @@ -90,7 +90,7 @@ var convert = function (s, numRows) { const carry = i % cycle // 计算索引, 如果余数小于 numRows, 那就用这个余数即可, 否则用循环数减去该余数 - const idx = carry < numRows ? carry : cycle - carry; + const idx = carry < numRows ? carry : cycle - carry res[idx] += s[i] } diff --git a/leetcode-docs/medium/7-reverse.mdx b/leetcode-docs/medium/7-reverse.mdx index 944a0ba1..e53dbc3d 100644 --- a/leetcode-docs/medium/7-reverse.mdx +++ b/leetcode-docs/medium/7-reverse.mdx @@ -75,6 +75,7 @@ pub fn reverse(x: i32) -> i32 { if n > i32::INT_MAX / 10 || n < i32::INT_MIN / 10 { return 0; } + n = n * 10 + (x % 10); x /= 10; } diff --git a/src/leetcode/rust/src/easy/question_14.rs b/src/leetcode/rust/src/easy/question_14.rs index fdc7d2a1..3b60a27a 100644 --- a/src/leetcode/rust/src/easy/question_14.rs +++ b/src/leetcode/rust/src/easy/question_14.rs @@ -1,5 +1,7 @@ #[allow(unused)] pub fn longest_common_prefix(strs: Vec) -> String { + let mut strs = strs; + strs.sort(); let mut prefix: &str = &strs[0]; let mut has_found = false; diff --git a/src/leetcode/rust/src/main.rs b/src/leetcode/rust/src/main.rs index 73c7fa8f..146c66a4 100644 --- a/src/leetcode/rust/src/main.rs +++ b/src/leetcode/rust/src/main.rs @@ -3,7 +3,11 @@ mod hard; mod medium; fn main() { - let res = medium::question_40::combination_sum2(vec![10, 1, 2, 7, 6, 1, 5], 8); + let res = easy::question_14::longest_common_prefix(vec![ + "flow".to_string(), + "flower".to_string(), + "flight".to_string(), + ]); println!("{:?}", res); } From c4dcbfb527ff20c5c47675a88053e61a7431ceb9 Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Tue, 31 Oct 2023 19:49:14 +0800 Subject: [PATCH 2/8] chore(deps): update dependencies --- package.json | 10 +- pnpm-lock.yaml | 327 +++++++++++++++++++++++++------------------------ 2 files changed, 169 insertions(+), 168 deletions(-) diff --git a/package.json b/package.json index 8e8a1f76..e6ea63a6 100644 --- a/package.json +++ b/package.json @@ -36,10 +36,10 @@ ] }, "dependencies": { - "@docusaurus/core": "^2.4.1", - "@docusaurus/plugin-ideal-image": "^2.4.1", - "@docusaurus/preset-classic": "^2.4.1", - "@docusaurus/theme-live-codeblock": "^2.4.1", + "@docusaurus/core": "^2.4.3", + "@docusaurus/plugin-ideal-image": "^2.4.3", + "@docusaurus/preset-classic": "^2.4.3", + "@docusaurus/theme-live-codeblock": "^2.4.3", "@mdx-js/react": "^1.6.22", "clsx": "^1.2.1", "nuka-carousel": "^4.8.4", @@ -49,7 +49,7 @@ "yancey-js-util": "^3.1.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^2.4.1", + "@docusaurus/module-type-aliases": "^2.4.3", "@tsconfig/docusaurus": "^1.0.7", "@types/jest": "^29.5.2", "@typescript-eslint/eslint-plugin": "^5.59.11", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dae3ad81..5de56016 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,11 +1,11 @@ lockfileVersion: 5.3 specifiers: - '@docusaurus/core': ^2.4.1 - '@docusaurus/module-type-aliases': ^2.4.1 - '@docusaurus/plugin-ideal-image': ^2.4.1 - '@docusaurus/preset-classic': ^2.4.1 - '@docusaurus/theme-live-codeblock': ^2.4.1 + '@docusaurus/core': ^2.4.3 + '@docusaurus/module-type-aliases': ^2.4.3 + '@docusaurus/plugin-ideal-image': ^2.4.3 + '@docusaurus/preset-classic': ^2.4.3 + '@docusaurus/theme-live-codeblock': ^2.4.3 '@mdx-js/react': ^1.6.22 '@tsconfig/docusaurus': ^1.0.7 '@types/jest': ^29.5.2 @@ -30,10 +30,10 @@ specifiers: yancey-js-util: ^3.1.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/plugin-ideal-image': 2.4.1_e478e4354c6a8bdec570dd17811320de - '@docusaurus/preset-classic': 2.4.1_11b0b38146bf0265f54681003e21d211 - '@docusaurus/theme-live-codeblock': 2.4.1_64ad60a764220385410f24a6cb3d75c5 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/plugin-ideal-image': 2.4.3_e478e4354c6a8bdec570dd17811320de + '@docusaurus/preset-classic': 2.4.3_11b0b38146bf0265f54681003e21d211 + '@docusaurus/theme-live-codeblock': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 '@mdx-js/react': 1.6.22_react@17.0.2 clsx: 1.2.1 nuka-carousel: 4.8.4_react-dom@17.0.2+react@17.0.2 @@ -43,7 +43,7 @@ dependencies: yancey-js-util: 3.1.0 devDependencies: - '@docusaurus/module-type-aliases': 2.4.1_react-dom@17.0.2+react@17.0.2 + '@docusaurus/module-type-aliases': 2.4.3_react-dom@17.0.2+react@17.0.2 '@tsconfig/docusaurus': 1.0.7 '@types/jest': 29.5.3 '@typescript-eslint/eslint-plugin': 5.62.0_17357f68f3a550d4e1de94100f3b1b27 @@ -531,11 +531,12 @@ packages: /@babel/plugin-proposal-object-rest-spread/7.12.1_@babel+core@7.12.9: resolution: {integrity: sha512-s6SowJIjzlhx8o7lsFx5zmY4At6CTtDvgNQDdPzkBQucle58A6b/TTeEBYtyDgmcXjUTM+vE8YOGHZzzbc/ioA==} + deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead. peerDependencies: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.12.9 - '@babel/helper-plugin-utils': 7.10.4 + '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-object-rest-spread': 7.8.3_@babel+core@7.12.9 '@babel/plugin-transform-parameters': 7.22.5_@babel+core@7.12.9 dev: false @@ -1606,8 +1607,8 @@ packages: - search-insights dev: false - /@docusaurus/core/2.4.1_64ad60a764220385410f24a6cb3d75c5: - resolution: {integrity: sha512-SNsY7PshK3Ri7vtsLXVeAJGS50nJN3RgF836zkyUfAD01Fq+sAk5EwWgLw+nnm5KVNGDu7PRR2kRGDsWvqpo0g==} + /@docusaurus/core/2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03: + resolution: {integrity: sha512-dWH5P7cgeNSIg9ufReX6gaCl/TmrGKD38Orbwuz05WPhAQtFXHd5B8Qym1TiXfvUNvwoYKkAJOJuGe8ou0Z7PA==} engines: {node: '>=16.14'} hasBin: true peerDependencies: @@ -1624,13 +1625,13 @@ packages: '@babel/runtime': 7.22.10 '@babel/runtime-corejs3': 7.22.10 '@babel/traverse': 7.22.10 - '@docusaurus/cssnano-preset': 2.4.1 - '@docusaurus/logger': 2.4.1 - '@docusaurus/mdx-loader': 2.4.1_74890941a47e7ab9f847a410d32587bf + '@docusaurus/cssnano-preset': 2.4.3 + '@docusaurus/logger': 2.4.3 + '@docusaurus/mdx-loader': 2.4.3_8a50634ecb72b3a68db4bd835534bd98 '@docusaurus/react-loadable': 5.5.2_react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-common': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-common': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 '@slorber/static-site-generator-webpack-plugin': 4.0.7 '@svgr/webpack': 6.5.1 autoprefixer: 10.4.14_postcss@8.4.27 @@ -1706,8 +1707,8 @@ packages: - webpack-cli dev: false - /@docusaurus/cssnano-preset/2.4.1: - resolution: {integrity: sha512-ka+vqXwtcW1NbXxWsh6yA1Ckii1klY9E53cJ4O9J09nkMBgrNX3iEFED1fWdv8wf4mJjvGi5RLZ2p9hJNjsLyQ==} + /@docusaurus/cssnano-preset/2.4.3: + resolution: {integrity: sha512-ZvGSRCi7z9wLnZrXNPG6DmVPHdKGd8dIn9pYbEOFiYihfv4uDR3UtxogmKf+rT8ZlKFf5Lqne8E8nt08zNM8CA==} engines: {node: '>=16.14'} dependencies: cssnano-preset-advanced: 5.3.10_postcss@8.4.27 @@ -1716,19 +1717,19 @@ packages: tslib: 2.6.1 dev: false - /@docusaurus/logger/2.4.1: - resolution: {integrity: sha512-5h5ysIIWYIDHyTVd8BjheZmQZmEgWDR54aQ1BX9pjFfpyzFo5puKXKYrYJXbjEHGyVhEzmB9UXwbxGfaZhOjcg==} + /@docusaurus/logger/2.4.3: + resolution: {integrity: sha512-Zxws7r3yLufk9xM1zq9ged0YHs65mlRmtsobnFkdZTxWXdTYlWWLWdKyNKAsVC+D7zg+pv2fGbyabdOnyZOM3w==} engines: {node: '>=16.14'} dependencies: chalk: 4.1.2 tslib: 2.6.1 dev: false - /@docusaurus/lqip-loader/2.4.1_webpack@5.88.2: - resolution: {integrity: sha512-XJ0z/xSx5HtAQ+/xBoAiRZ7DY9zEP6IImAKlAk6RxuFzyB4HT8eINWN+LwLnOsTh5boIj37JCX+T76bH0ieULA==} + /@docusaurus/lqip-loader/2.4.3_webpack@5.88.2: + resolution: {integrity: sha512-hdumVOGbI4eiQQsZvbbosnm86FNkp23GikNanC0MJIIz8j3sCg8I0GEmg9nnVZor/2tE4ud5AWqjsVrx1CwcjA==} engines: {node: '>=16.14'} dependencies: - '@docusaurus/logger': 2.4.1 + '@docusaurus/logger': 2.4.3 file-loader: 6.2.0_webpack@5.88.2 lodash: 4.17.21 sharp: 0.30.7 @@ -1737,8 +1738,8 @@ packages: - webpack dev: false - /@docusaurus/mdx-loader/2.4.1_74890941a47e7ab9f847a410d32587bf: - resolution: {integrity: sha512-4KhUhEavteIAmbBj7LVFnrVYDiU51H5YWW1zY6SmBSte/YLhDutztLTBE0PQl1Grux1jzUJeaSvAzHpTn6JJDQ==} + /@docusaurus/mdx-loader/2.4.3_8a50634ecb72b3a68db4bd835534bd98: + resolution: {integrity: sha512-b1+fDnWtl3GiqkL0BRjYtc94FZrcDDBV1j8446+4tptB9BAOlePwG2p/pK6vGvfL53lkOsszXMghr2g67M0vCw==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 @@ -1746,8 +1747,8 @@ packages: dependencies: '@babel/parser': 7.22.10 '@babel/traverse': 7.22.10 - '@docusaurus/logger': 2.4.1 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/logger': 2.4.3 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 '@mdx-js/mdx': 1.6.22 escape-html: 1.0.3 file-loader: 6.2.0_webpack@5.88.2 @@ -1772,14 +1773,14 @@ packages: - webpack-cli dev: false - /@docusaurus/module-type-aliases/2.4.1_react-dom@17.0.2+react@17.0.2: - resolution: {integrity: sha512-gLBuIFM8Dp2XOCWffUDSjtxY7jQgKvYujt7Mx5s4FCTfoL5dN1EVbnrn+O2Wvh8b0a77D57qoIDY7ghgmatR1A==} + /@docusaurus/module-type-aliases/2.4.3_react-dom@17.0.2+react@17.0.2: + resolution: {integrity: sha512-cwkBkt1UCiduuvEAo7XZY01dJfRn7UR/75mBgOdb1hKknhrabJZ8YH+7savd/y9kLExPyrhe0QwdS9GuzsRRIA==} peerDependencies: react: '*' react-dom: '*' dependencies: '@docusaurus/react-loadable': 5.5.2_react@17.0.2 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 '@types/history': 4.7.11 '@types/react': 18.2.20 '@types/react-router-config': 5.0.7 @@ -1794,20 +1795,20 @@ packages: - uglify-js - webpack-cli - /@docusaurus/plugin-content-blog/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-E2i7Knz5YIbE1XELI6RlTnZnGgS52cUO4BlCiCUCvQHbR+s1xeIWz4C6BtaVnlug0Ccz7nFSksfwDpVlkujg5Q==} + /@docusaurus/plugin-content-blog/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-PVhypqaA0t98zVDpOeTqWUTvRqCEjJubtfFUQ7zJNYdbYTbS/E/ytq6zbLVsN/dImvemtO/5JQgjLxsh8XLo8Q==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/logger': 2.4.1 - '@docusaurus/mdx-loader': 2.4.1_74890941a47e7ab9f847a410d32587bf - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-common': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/logger': 2.4.3 + '@docusaurus/mdx-loader': 2.4.3_8a50634ecb72b3a68db4bd835534bd98 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-common': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 cheerio: 1.0.0-rc.12 feed: 4.2.2 fs-extra: 10.1.0 @@ -1837,20 +1838,20 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-content-docs/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-Lo7lSIcpswa2Kv4HEeUcGYqaasMUQNpjTXpV0N8G6jXgZaQurqp7E8NGYeGbDXnb48czmHWbzDL4S3+BbK0VzA==} + /@docusaurus/plugin-content-docs/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-N7Po2LSH6UejQhzTCsvuX5NOzlC+HiXOVvofnEPj0WhMu1etpLEXE6a4aTxrtg95lQ5kf0xUIdjX9sh3d3G76A==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/logger': 2.4.1 - '@docusaurus/mdx-loader': 2.4.1_74890941a47e7ab9f847a410d32587bf - '@docusaurus/module-type-aliases': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/logger': 2.4.3 + '@docusaurus/mdx-loader': 2.4.3_8a50634ecb72b3a68db4bd835534bd98 + '@docusaurus/module-type-aliases': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 '@types/react-router-config': 5.0.7 combine-promises: 1.1.0 fs-extra: 10.1.0 @@ -1880,18 +1881,18 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-content-pages/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-/UjuH/76KLaUlL+o1OvyORynv6FURzjurSjvn2lbWTFc4tpYY2qLYTlKpTCBVPhlLUQsfyFnshEJDLmPneq2oA==} + /@docusaurus/plugin-content-pages/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-txtDVz7y3zGk67q0HjG0gRttVPodkHqE0bpJ+7dOaTH40CQFLSh7+aBeGnPOTl+oCPG+hxkim4SndqPqXjQ8Bg==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/mdx-loader': 2.4.1_74890941a47e7ab9f847a410d32587bf - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/mdx-loader': 2.4.3_8a50634ecb72b3a68db4bd835534bd98 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 fs-extra: 10.1.0 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 @@ -1915,16 +1916,16 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-debug/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-7Yu9UPzRShlrH/G8btOpR0e6INFZr0EegWplMjOqelIwAcx3PKyR8mgPTxGTxcqiYj6hxSCRN0D8R7YrzImwNA==} + /@docusaurus/plugin-debug/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-LkUbuq3zCmINlFb+gAd4ZvYr+bPAzMC0hwND4F7V9bZ852dCX8YoWyovVUBKq4er1XsOwSQaHmNGtObtn8Av8Q==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 fs-extra: 10.1.0 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 @@ -1950,16 +1951,16 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-google-analytics/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-dyZJdJiCoL+rcfnm0RPkLt/o732HvLiEwmtoNzOoz9MSZz117UH2J6U2vUDtzUzwtFLIf32KkeyzisbwUCgcaQ==} + /@docusaurus/plugin-google-analytics/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-KzBV3k8lDkWOhg/oYGxlK5o9bOwX7KpPc/FTWoB+SfKhlHfhq7qcQdMi1elAaVEIop8tgK6gD1E58Q+XC6otSQ==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 tslib: 2.6.1 @@ -1981,16 +1982,16 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-google-gtag/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-mKIefK+2kGTQBYvloNEKtDmnRD7bxHLsBcxgnbt4oZwzi2nxCGjPX6+9SQO2KCN5HZbNrYmGo5GJfMgoRvy6uA==} + /@docusaurus/plugin-google-gtag/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-5FMg0rT7sDy4i9AGsvJC71MQrqQZwgLNdDetLEGDHLfSHLvJhQbTCUGbGXknUgWXQJckcV/AILYeJy+HhxeIFA==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 tslib: 2.6.1 @@ -2012,16 +2013,16 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-google-tag-manager/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-Zg4Ii9CMOLfpeV2nG74lVTWNtisFaH9QNtEw48R5QE1KIwDBdTVaiSA18G1EujZjrzJJzXN79VhINSbOJO/r3g==} + /@docusaurus/plugin-google-tag-manager/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-1jTzp71yDGuQiX9Bi0pVp3alArV0LSnHXempvQTxwCGAEzUWWaBg4d8pocAlTpbP9aULQQqhgzrs8hgTRPOM0A==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 tslib: 2.6.1 @@ -2043,8 +2044,8 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-ideal-image/2.4.1_e478e4354c6a8bdec570dd17811320de: - resolution: {integrity: sha512-jxvgCGPmHxdae2Y2uskzxIbMCA4WLTfzkufsLbD4mEAjCRIkt6yzux6q5kqKTrO+AxzpANVcJNGmaBtKZGv5aw==} + /@docusaurus/plugin-ideal-image/2.4.3_e478e4354c6a8bdec570dd17811320de: + resolution: {integrity: sha512-cwnOKz5HwR/WwNL5lzGOWppyhaHQ2dPj1/x9hwv5VPwNmDDnWsYEwfBOTq8AYT27vFrYAH1tx9UX7QurRaIa4A==} engines: {node: '>=16.14'} peerDependencies: jimp: '*' @@ -2054,12 +2055,12 @@ packages: jimp: optional: true dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/lqip-loader': 2.4.1_webpack@5.88.2 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/lqip-loader': 2.4.3_webpack@5.88.2 '@docusaurus/responsive-loader': 1.7.0_sharp@0.30.7 - '@docusaurus/theme-translations': 2.4.1 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/theme-translations': 2.4.3 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 '@endiliey/react-ideal-image': 0.0.11_3908dce77220f34c0b88f858b136649d react: 17.0.2 react-dom: 17.0.2_react@17.0.2 @@ -2086,19 +2087,19 @@ packages: - webpack-cli dev: false - /@docusaurus/plugin-sitemap/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-lZx+ijt/+atQ3FVE8FOHV/+X3kuok688OydDXrqKRJyXBJZKgGjA2Qa8RjQ4f27V2woaXhtnyrdPop/+OjVMRg==} + /@docusaurus/plugin-sitemap/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-LRQYrK1oH1rNfr4YvWBmRzTL0LN9UAPxBbghgeFRBm5yloF6P+zv1tm2pe2hQTX/QP5bSKdnajCvfnScgKXMZQ==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/logger': 2.4.1 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-common': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/logger': 2.4.3 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-common': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 fs-extra: 10.1.0 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 @@ -2122,26 +2123,26 @@ packages: - webpack-cli dev: false - /@docusaurus/preset-classic/2.4.1_11b0b38146bf0265f54681003e21d211: - resolution: {integrity: sha512-P4//+I4zDqQJ+UDgoFrjIFaQ1MeS9UD1cvxVQaI6O7iBmiHQm0MGROP1TbE7HlxlDPXFJjZUK3x3cAoK63smGQ==} + /@docusaurus/preset-classic/2.4.3_11b0b38146bf0265f54681003e21d211: + resolution: {integrity: sha512-tRyMliepY11Ym6hB1rAFSNGwQDpmszvWYJvlK1E+md4SW8i6ylNHtpZjaYFff9Mdk3i/Pg8ItQq9P0daOJAvQw==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/plugin-content-blog': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-content-docs': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-content-pages': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-debug': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-google-analytics': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-google-gtag': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-google-tag-manager': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-sitemap': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/theme-classic': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/theme-common': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/theme-search-algolia': 2.4.1_510d8b36d080a937d9266c362c2ba2fe - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/plugin-content-blog': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-content-docs': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-content-pages': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-debug': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-google-analytics': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-google-gtag': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-google-tag-manager': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-sitemap': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/theme-classic': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/theme-common': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/theme-search-algolia': 2.4.3_78acc927aa2da2518bbf75c5fb0e89e7 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 transitivePeerDependencies: @@ -2191,25 +2192,25 @@ packages: sharp: 0.30.7 dev: false - /@docusaurus/theme-classic/2.4.1_7771b1d045ad028ab32b9f7578d1ee58: - resolution: {integrity: sha512-Rz0wKUa+LTW1PLXmwnf8mn85EBzaGSt6qamqtmnh9Hflkc+EqiYMhtUJeLdV+wsgYq4aG0ANc+bpUDpsUhdnwg==} + /@docusaurus/theme-classic/2.4.3_7771b1d045ad028ab32b9f7578d1ee58: + resolution: {integrity: sha512-QKRAJPSGPfDY2yCiPMIVyr+MqwZCIV2lxNzqbyUW0YkrlmdzzP3WuQJPMGLCjWgQp/5c9kpWMvMxjhpZx1R32Q==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/mdx-loader': 2.4.1_74890941a47e7ab9f847a410d32587bf - '@docusaurus/module-type-aliases': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/plugin-content-blog': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-content-docs': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-content-pages': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/theme-common': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/theme-translations': 2.4.1 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-common': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/mdx-loader': 2.4.3_8a50634ecb72b3a68db4bd835534bd98 + '@docusaurus/module-type-aliases': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/plugin-content-blog': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-content-docs': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-content-pages': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/theme-common': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/theme-translations': 2.4.3 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-common': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 '@mdx-js/react': 1.6.22_react@17.0.2 clsx: 1.2.1 copy-text-to-clipboard: 3.2.0 @@ -2243,20 +2244,20 @@ packages: - webpack-cli dev: false - /@docusaurus/theme-common/2.4.1_64ad60a764220385410f24a6cb3d75c5: - resolution: {integrity: sha512-G7Zau1W5rQTaFFB3x3soQoZpkgMbl/SYNG8PfMFIjKa3M3q8n0m/GRf5/H/e5BqOvt8c+ZWIXGCiz+kUCSHovA==} + /@docusaurus/theme-common/2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03: + resolution: {integrity: sha512-7KaDJBXKBVGXw5WOVt84FtN8czGWhM0lbyWEZXGp8AFfL6sZQfRTluFp4QriR97qwzSyOfQb+nzcDZZU4tezUw==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/mdx-loader': 2.4.1_74890941a47e7ab9f847a410d32587bf - '@docusaurus/module-type-aliases': 2.4.1_react-dom@17.0.2+react@17.0.2 - '@docusaurus/plugin-content-blog': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-content-docs': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/plugin-content-pages': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-common': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/mdx-loader': 2.4.3_8a50634ecb72b3a68db4bd835534bd98 + '@docusaurus/module-type-aliases': 2.4.3_react-dom@17.0.2+react@17.0.2 + '@docusaurus/plugin-content-blog': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-content-docs': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/plugin-content-pages': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-common': 2.4.3_@docusaurus+types@2.4.3 '@types/history': 4.7.11 '@types/react': 18.2.20 '@types/react-router-config': 5.0.7 @@ -2287,17 +2288,17 @@ packages: - webpack-cli dev: false - /@docusaurus/theme-live-codeblock/2.4.1_64ad60a764220385410f24a6cb3d75c5: - resolution: {integrity: sha512-KBKrm34kcdNbSeEm6RujN5GWWg4F2dmAYZyHMMQM8FXokx8mNShRx6uq17WXi23JNm7niyMhNOBRfZWay+5Hkg==} + /@docusaurus/theme-live-codeblock/2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03: + resolution: {integrity: sha512-wx+iJCCoSewUkMzFy7pnbhDBCRcJRTLkpx1/zwnHhfiNWVvJ2XjtBKIviRyMhynZYyvO4sLTpCclzK8JOctkxw==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/theme-common': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/theme-translations': 2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/theme-common': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/theme-translations': 2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 '@philpl/buble': 0.19.7 clsx: 1.2.1 fs-extra: 10.1.0 @@ -2324,21 +2325,21 @@ packages: - webpack-cli dev: false - /@docusaurus/theme-search-algolia/2.4.1_510d8b36d080a937d9266c362c2ba2fe: - resolution: {integrity: sha512-6BcqW2lnLhZCXuMAvPRezFs1DpmEKzXFKlYjruuas+Xy3AQeFzDJKTJFIm49N77WFCTyxff8d3E4Q9pi/+5McQ==} + /@docusaurus/theme-search-algolia/2.4.3_78acc927aa2da2518bbf75c5fb0e89e7: + resolution: {integrity: sha512-jziq4f6YVUB5hZOB85ELATwnxBz/RmSLD3ksGQOLDPKVzat4pmI8tddNWtriPpxR04BNT+ZfpPUMFkNFetSW1Q==} engines: {node: '>=16.14'} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 dependencies: '@docsearch/react': 3.5.1_a3fa30dee1dc422145b0db1e7f0a1b82 - '@docusaurus/core': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/logger': 2.4.1 - '@docusaurus/plugin-content-docs': 2.4.1_7771b1d045ad028ab32b9f7578d1ee58 - '@docusaurus/theme-common': 2.4.1_64ad60a764220385410f24a6cb3d75c5 - '@docusaurus/theme-translations': 2.4.1 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 - '@docusaurus/utils-validation': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/core': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/logger': 2.4.3 + '@docusaurus/plugin-content-docs': 2.4.3_7771b1d045ad028ab32b9f7578d1ee58 + '@docusaurus/theme-common': 2.4.3_a67fbf889ffb8d0e2205a7e4c11d0f03 + '@docusaurus/theme-translations': 2.4.3 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 + '@docusaurus/utils-validation': 2.4.3_@docusaurus+types@2.4.3 algoliasearch: 4.19.1 algoliasearch-helper: 3.14.0_algoliasearch@4.19.1 clsx: 1.2.1 @@ -2371,16 +2372,16 @@ packages: - webpack-cli dev: false - /@docusaurus/theme-translations/2.4.1: - resolution: {integrity: sha512-T1RAGP+f86CA1kfE8ejZ3T3pUU3XcyvrGMfC/zxCtc2BsnoexuNI9Vk2CmuKCb+Tacvhxjv5unhxXce0+NKyvA==} + /@docusaurus/theme-translations/2.4.3: + resolution: {integrity: sha512-H4D+lbZbjbKNS/Zw1Lel64PioUAIT3cLYYJLUf3KkuO/oc9e0QCVhIYVtUI2SfBCF2NNdlyhBDQEEMygsCedIg==} engines: {node: '>=16.14'} dependencies: fs-extra: 10.1.0 tslib: 2.6.1 dev: false - /@docusaurus/types/2.4.1_react-dom@17.0.2+react@17.0.2: - resolution: {integrity: sha512-0R+cbhpMkhbRXX138UOc/2XZFF8hiZa6ooZAEEJFp5scytzCw4tC1gChMFXrpa3d2tYE6AX8IrOEpSonLmfQuQ==} + /@docusaurus/types/2.4.3_react-dom@17.0.2+react@17.0.2: + resolution: {integrity: sha512-W6zNLGQqfrp/EoPD0bhb9n7OobP+RHpmvVzpA+Z/IuU3Q63njJM24hmT0GYboovWcDtFmnIJC9wcyx4RVPQscw==} peerDependencies: react: ^16.8.4 || ^17.0.0 react-dom: ^16.8.4 || ^17.0.0 @@ -2401,8 +2402,8 @@ packages: - uglify-js - webpack-cli - /@docusaurus/utils-common/2.4.1_@docusaurus+types@2.4.1: - resolution: {integrity: sha512-bCVGdZU+z/qVcIiEQdyx0K13OC5mYwxhSuDUR95oFbKVuXYRrTVrwZIqQljuo1fyJvFTKHiL9L9skQOPokuFNQ==} + /@docusaurus/utils-common/2.4.3_@docusaurus+types@2.4.3: + resolution: {integrity: sha512-/jascp4GbLQCPVmcGkPzEQjNaAk3ADVfMtudk49Ggb+131B1WDD6HqlSmDf8MxGdy7Dja2gc+StHf01kiWoTDQ==} engines: {node: '>=16.14'} peerDependencies: '@docusaurus/types': '*' @@ -2410,16 +2411,16 @@ packages: '@docusaurus/types': optional: true dependencies: - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 tslib: 2.6.1 dev: false - /@docusaurus/utils-validation/2.4.1_@docusaurus+types@2.4.1: - resolution: {integrity: sha512-unII3hlJlDwZ3w8U+pMO3Lx3RhI4YEbY3YNsQj4yzrkZzlpqZOLuAiZK2JyULnD+TKbceKU0WyWkQXtYbLNDFA==} + /@docusaurus/utils-validation/2.4.3_@docusaurus+types@2.4.3: + resolution: {integrity: sha512-G2+Vt3WR5E/9drAobP+hhZQMaswRwDlp6qOMi7o7ZypB+VO7N//DZWhZEwhcRGepMDJGQEwtPv7UxtYwPL9PBw==} engines: {node: '>=16.14'} dependencies: - '@docusaurus/logger': 2.4.1 - '@docusaurus/utils': 2.4.1_@docusaurus+types@2.4.1 + '@docusaurus/logger': 2.4.3 + '@docusaurus/utils': 2.4.3_@docusaurus+types@2.4.3 joi: 17.9.2 js-yaml: 4.1.0 tslib: 2.6.1 @@ -2432,8 +2433,8 @@ packages: - webpack-cli dev: false - /@docusaurus/utils/2.4.1_@docusaurus+types@2.4.1: - resolution: {integrity: sha512-1lvEZdAQhKNht9aPXPoh69eeKnV0/62ROhQeFKKxmzd0zkcuE/Oc5Gpnt00y/f5bIsmOsYMY7Pqfm/5rteT5GA==} + /@docusaurus/utils/2.4.3_@docusaurus+types@2.4.3: + resolution: {integrity: sha512-fKcXsjrD86Smxv8Pt0TBFqYieZZCPh4cbf9oszUq/AMhZn3ujwpKaVYZACPX8mmjtYx0JOgNx52CREBfiGQB4A==} engines: {node: '>=16.14'} peerDependencies: '@docusaurus/types': '*' @@ -2441,8 +2442,8 @@ packages: '@docusaurus/types': optional: true dependencies: - '@docusaurus/logger': 2.4.1 - '@docusaurus/types': 2.4.1_react-dom@17.0.2+react@17.0.2 + '@docusaurus/logger': 2.4.3 + '@docusaurus/types': 2.4.3_react-dom@17.0.2+react@17.0.2 '@svgr/webpack': 6.5.1 escape-string-regexp: 4.0.0 file-loader: 6.2.0_webpack@5.88.2 @@ -3793,7 +3794,7 @@ packages: /@types/sax/1.2.4: resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} dependencies: - '@types/node': 17.0.45 + '@types/node': 20.4.9 dev: false /@types/scheduler/0.16.3: @@ -6783,7 +6784,7 @@ packages: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} /fast-url-parser/1.1.3: - resolution: {integrity: sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=} + resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: punycode: 1.4.1 dev: false From 19a511c9ca4733ee4106c3240d101139f82c694c Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Fri, 3 Nov 2023 18:51:59 +0800 Subject: [PATCH 3/8] feat: update --- leetcode-docs/hard/10-is-match.mdx | 2 +- leetcode-docs/hard/25-reverse-k-group.mdx | 13 ++++++------- leetcode-docs/hard/30-find-substring.mdx | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/leetcode-docs/hard/10-is-match.mdx b/leetcode-docs/hard/10-is-match.mdx index 7745a156..c8008a93 100644 --- a/leetcode-docs/hard/10-is-match.mdx +++ b/leetcode-docs/hard/10-is-match.mdx @@ -111,7 +111,7 @@ var isMatch = function (s, p) { for (let i = 1; i <= m; i++) { for (let j = 1; j <= n; j++) { // 字母匹配上了, 或者 p 此时为 . 可能任意匹配, 状态从前一个转移过来即可 - if (p[j - 1] === s[i - 1] || p[j - 1] === '.') { + if (s[i - 1] === p[j - 1] || p[j - 1] === '.') { dp[i][j] = dp[i - 1][j - 1] // 如果遇到 *, 需要关注 * 前面那个 } else if (p[j - 1] === '*') { diff --git a/leetcode-docs/hard/25-reverse-k-group.mdx b/leetcode-docs/hard/25-reverse-k-group.mdx index 6c400351..097ff73c 100644 --- a/leetcode-docs/hard/25-reverse-k-group.mdx +++ b/leetcode-docs/hard/25-reverse-k-group.mdx @@ -83,15 +83,14 @@ var reverseKGroup = function (head, k) { * @return {ListNode} */ var reverse = function (a, b) { - let prev = null, - head = a + let prev = null // 在 a, b 区间翻转 - while (head !== b) { - const temp = head.next - head.next = prev - prev = head - head = temp + while (a !== b) { + const tmp = a.next + a.next = prev + prev = a + a = tmp } return prev diff --git a/leetcode-docs/hard/30-find-substring.mdx b/leetcode-docs/hard/30-find-substring.mdx index 3b5de442..c9ca2506 100644 --- a/leetcode-docs/hard/30-find-substring.mdx +++ b/leetcode-docs/hard/30-find-substring.mdx @@ -15,7 +15,7 @@ sidebar_label: 30. 串联所有单词的子串 :::note 提示: -- `1 <= s.length <= 104` +- `1 <= s.length <= 10⁴` - `1 <= words.length <= 5000` - `1 <= words[i].length <= 30` - `words[i]` 和 `s` 由小写英文字母组成 @@ -94,7 +94,7 @@ var findSubstring = function (s, words) { // 声明一个新的哈希表 subMap, 记录 subStr 中每 w 个小字符串 const subMap = new Map() - for (let j = 0; j < n * w; i += w) { + for (let j = 0; j < n * w; j += w) { const sub = subStr.slice(j, j + w) // 如果 words 中都没有子字符串, 可以提前终止 From 6a466049bc4ac681e1ce92caa9c69cedfbf47426 Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Tue, 14 Nov 2023 15:16:45 +0800 Subject: [PATCH 4/8] feat: finish 95 --- .../easy/108-sorted-array-to-bst.mdx | 16 +++++----- leetcode-docs/easy/111-min-depth.mdx | 32 +++++++++++-------- leetcode-docs/easy/112-has-path-sum.mdx | 2 +- leetcode-docs/medium/95-generate-trees.mdx | 27 ++++++++++++++-- ...346\220\234\347\264\242\346\240\221-ii.js" | 23 ++++++++++++- 5 files changed, 75 insertions(+), 25 deletions(-) diff --git a/leetcode-docs/easy/108-sorted-array-to-bst.mdx b/leetcode-docs/easy/108-sorted-array-to-bst.mdx index 01278036..9b32a1a9 100644 --- a/leetcode-docs/easy/108-sorted-array-to-bst.mdx +++ b/leetcode-docs/easy/108-sorted-array-to-bst.mdx @@ -16,7 +16,7 @@ keywords: :::info 示例 -输入: nums = [-10, -3, 0, 5, 9] +输入: `nums = [-10, -3, 0, 5, 9]` 输出: @@ -49,15 +49,15 @@ var sortedArrayToBST = function (nums) { return buildBST(nums, 0, nums.length - 1) } -var buildBST = (nums, start, end) => { - // 不可能出现 start > end - if (start > end) return null +var buildBST = (nums, startIdx, endIdx) => { + // 不可能出现 startIdx > endIdx + if (startIdx > endIdx) return null - const midIndex = (start + end) >>> 1 // 求中间索引 - const root = new TreeNode(nums[midIndex]) // 构建当前节点 + const midIdx = (startIdx + endIdx) >>> 1 // 求中间索引 + const root = new TreeNode(nums[midIdx]) // 构建当前节点 - root.left = buildBST(nums, start, midIndex - 1) // 构建左子树 - root.right = buildBST(nums, midIndex + 1, end) // 构建右子树 + root.left = buildBST(nums, startIdx, midIdx - 1) // 构建左子树 + root.right = buildBST(nums, midIdx + 1, endIdx) // 构建右子树 return root } diff --git a/leetcode-docs/easy/111-min-depth.mdx b/leetcode-docs/easy/111-min-depth.mdx index eb33df65..bb80d165 100644 --- a/leetcode-docs/easy/111-min-depth.mdx +++ b/leetcode-docs/easy/111-min-depth.mdx @@ -18,22 +18,22 @@ sidebar_label: 111. 二叉树的最小深度 15 7 ``` -输入: root = [3, 9, 20, null, null, 15, 7] +输入: `root = [3, 9, 20, null, null, 15, 7]` 输出: 2 ::: ## 题解 -### 深度优先遍历 +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' -1. 如果 root 都没有, 直接返回 0 -2. 如果有 root, 但 root 没有叶子节点, 返回 1 -3. 对于其他情况: 如果存在左叶子节点, 就一直往左递归, 并计算最小深度; 如果存在右叶子节点, 就一直往右递归, 并计算最小深度. - -时间复杂度: O(n) + + -空间复杂度: O(logn) +1. 如果 `root` 都没有, 直接返回 `0` +2. 如果有 `root`, 但 `root` 没有叶子节点, 返回 `1` +3. 对于其他情况: 如果存在左叶子节点, 就一直往左递归, 并计算最小深度; 如果存在右叶子节点, 就一直往右递归, 并计算最小深度. ```ts /** @@ -70,13 +70,13 @@ var minDepth = function (root) { } ``` -### 广度优先遍历 - -广度优先遍历的核心思想是**队列**, 具体思想可以看 [深度/广度优先遍历](/algorithm-design/dfs-bfs), 该题的关键在于**当某个节点没有子节点了, 那它就是最小的深度**, 其余的就是广度优先遍历的基本套路了, 这里不再赘述. +- 时间复杂度: `O(n)` +- 空间复杂度: `O(logn)` -时间复杂度: O(n) + + -空间复杂度: O(n) +广度优先遍历的核心思想是**队列**, 具体思想可以看 [深度/广度优先遍历](/algorithm-design/dfs-bfs), 该题的关键在于**当某个节点没有子节点了, 那它就是最小的深度**, 其余的就是广度优先遍历的基本套路了, 这里不再赘述. ```ts var minDepth = function (root) { @@ -111,3 +111,9 @@ var minDepth = function (root) { return depth } ``` + +- 时间复杂度: `O(n)` +- 空间复杂度: `O(n)` + + + diff --git a/leetcode-docs/easy/112-has-path-sum.mdx b/leetcode-docs/easy/112-has-path-sum.mdx index 42da0905..cd9272d5 100644 --- a/leetcode-docs/easy/112-has-path-sum.mdx +++ b/leetcode-docs/easy/112-has-path-sum.mdx @@ -56,7 +56,7 @@ keywords: * @return {boolean} */ var hasPathSum = function (root, targetSum) { - if (root === null) return + if (root === null) return false // 到了叶子结点了, 且值等于 targetSum if (!root.left && !root.right && root.val === targetSum) { diff --git a/leetcode-docs/medium/95-generate-trees.mdx b/leetcode-docs/medium/95-generate-trees.mdx index 2e3a0498..a0406708 100644 --- a/leetcode-docs/medium/95-generate-trees.mdx +++ b/leetcode-docs/medium/95-generate-trees.mdx @@ -38,7 +38,7 @@ keywords: ## 题解 -这里是题解这里是题解这里是题解这里是题解这里是题解 +二叉搜索树性质是根节点的值大于左子树所有节点的值, 小于右子树所有节点的值, 且左子树和右子树也同样为二叉搜索树. ```ts /** @@ -53,5 +53,28 @@ keywords: * @param {number} n * @return {TreeNode[]} */ -var generateTrees = function (n) {} +var generateTrees = function (n) { + var dfs = function (l, r) { + if (l > r) return [null] + const res = [] + + for (let i = l; i <= r; i++) { + // [l, i - 1] 用做左子树 + for (const x of dfs(l, i - 1)) { + // [i + 1, r] 用做右子树 + for (const y of dfs(i + 1, r)) { + // i 作为中点 + const root = new TreeNode(i) + root.left = x + root.right = y + res.push(root) + } + } + } + + return res + } + + return dfs(1, n) +} ``` diff --git "a/src/leetcode/javascript/medium/95.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221-ii.js" "b/src/leetcode/javascript/medium/95.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221-ii.js" index f2f3e55d..826a3213 100644 --- "a/src/leetcode/javascript/medium/95.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221-ii.js" +++ "b/src/leetcode/javascript/medium/95.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221-ii.js" @@ -17,5 +17,26 @@ * @param {number} n * @return {TreeNode[]} */ -var generateTrees = function (n) {} +var generateTrees = function (n) { + var dfs = function (l, r) { + if (l > r) return [null] + const res = [] + + for (let i = l; i <= r; i++) { + for (const x of dfs(l, i - 1)) { + for (const y of dfs(i + 1, r)) { + const root = new TreeNode(i) + root.left = x + root.right = y + res.push(root) + } + } + } + + return res + } + + return dfs(1, n) +} + // @lc code=end From 381a16856d2bcf23afd00eb0fcaf84ce9f627cc3 Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Tue, 14 Nov 2023 20:29:33 +0800 Subject: [PATCH 5/8] feat: finish 99-recover-tree --- leetcode-docs/medium/95-generate-trees.mdx | 5 + leetcode-docs/medium/96-num-trees.mdx | 17 ++- leetcode-docs/medium/99-recover-tree.mdx | 103 ++++++++++++++++++ ...11\346\220\234\347\264\242\346\240\221.js" | 14 ++- ...11\346\220\234\347\264\242\346\240\221.js" | 60 ++++++++++ src/leetcode/rust/src/medium/mod.rs | 5 +- src/leetcode/rust/src/medium/question_99.rs | 1 + static/img/99-recover-tree-1.jpg | Bin 0 -> 14332 bytes static/img/99-recover-tree-2.jpg | Bin 0 -> 19255 bytes 9 files changed, 200 insertions(+), 5 deletions(-) create mode 100644 leetcode-docs/medium/99-recover-tree.mdx create mode 100644 "src/leetcode/javascript/medium/99.\346\201\242\345\244\215\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" create mode 100644 src/leetcode/rust/src/medium/question_99.rs create mode 100644 static/img/99-recover-tree-1.jpg create mode 100644 static/img/99-recover-tree-2.jpg diff --git a/leetcode-docs/medium/95-generate-trees.mdx b/leetcode-docs/medium/95-generate-trees.mdx index a0406708..d707eb6d 100644 --- a/leetcode-docs/medium/95-generate-trees.mdx +++ b/leetcode-docs/medium/95-generate-trees.mdx @@ -78,3 +78,8 @@ var generateTrees = function (n) { return dfs(1, n) } ``` + +## 复杂度分析 + +- 时间复杂度:卡特兰数 +- 空间复杂度: 卡特兰数 diff --git a/leetcode-docs/medium/96-num-trees.mdx b/leetcode-docs/medium/96-num-trees.mdx index fcba45c4..b58ed937 100644 --- a/leetcode-docs/medium/96-num-trees.mdx +++ b/leetcode-docs/medium/96-num-trees.mdx @@ -38,12 +38,25 @@ keywords: ## 题解 -这里是题解这里是题解这里是题解这里是题解这里是题解 +给定一个有序序列 `1` 到 `n`,为了构建出一棵二叉搜索树, 我们可以遍历每个数字 `i`, 将该数字作为树根, 将 `1` 到 `i - 1` 序列作为左子树,将 `i + 1` 到 `n` 序列作为右子树. +接着我们可以按照同样的方式递归构建左子树和右子树. ```ts /** * @param {number} n * @return {number} */ -var numTrees = function (n) {} +var numTrees = function (n) { + const dp = new Array(n + 1).fill(0) + dp[0] = 1 + dp[1] = 1 + + for (let i = 2; i <= n; i++) { + for (let j = 1; j <= i; j++) { + dp[i] += dp[j - 1] * dp[i - j] + } + } + + return dp[n] +} ``` diff --git a/leetcode-docs/medium/99-recover-tree.mdx b/leetcode-docs/medium/99-recover-tree.mdx new file mode 100644 index 00000000..4533e707 --- /dev/null +++ b/leetcode-docs/medium/99-recover-tree.mdx @@ -0,0 +1,103 @@ +--- +id: 99-recover-tree +title: 恢复二叉搜索树 +sidebar_label: 99. 恢复二叉搜索树 +keywords: + - Tree, BST +--- + +:::success Tips +题目类型: Tree, BST +::: + +## 题目 + +给你二叉搜索树的根节点 `root`. 该树中的**恰好两个节点**的值被错误地交换. 请在不改变其结构的情况下, 恢复这棵树. + +:::note 提示: + +- 树上节点的数目在范围 `[2, 1000]` 内 +- `-2³¹ <= Node.val <= 2³¹ - 1` + +::: + +:::info 示例 + +![33-search](../../static/img/99-recover-tree-1.jpg) + +```ts +输入:root = [1,3,null,null,2] +输出:[3,1,null,null,2] +解释:3 不能是 1 的左孩子,因为 3 > 1 。交换 1 和 3 使二叉搜索树有效。 +``` + +![33-search](../../static/img/99-recover-tree-2.jpg) + +```ts +输入:root = [3,1,4,null,null,2] +输出:[2,1,4,null,null,3] +解释:2 不能在 3 的右子树中,因为 2 < 3 。交换 2 和 3 使二叉搜索树有效。 +``` + +::: + +## 题解 + +1. 由于是 BST, 所以使用中序遍历, 把所有节点存储到 `list` 中 +2. 遍历这个列表 `list`, 由于 BST 的中序遍历应当是从小到大排列的, 所以如果前面的 val 大于了后面的 val, 说明后面这个应当靠前. +3. 找到两个需要交换的, 交换他们的值即可 + +```ts +/** + * Definition for a binary tree node. + * function TreeNode(val, left, right) { + * this.val = (val===undefined ? 0 : val) + * this.left = (left===undefined ? null : left) + * this.right = (right===undefined ? null : right) + * } + */ +/** + * @param {TreeNode} root + * @return {void} Do not return anything, modify root in-place instead. + */ +var recoverTree = function (root) { + const list = [] + inOrder(root, list) + let x = null + let y = null + + for (let i = 0; i < list.length - 1; i++) { + if (list[i].val > list[i + 1].val) { + y = list[i + 1] + if (!x) x = list[i] + } + } + + if (x && y) { + const tmp = x.val + x.val = y.val + y.val = tmp + } +} + +/** + * Definition for a binary tree node. + * function TreeNode(val, left, right) { + * this.val = (val===undefined ? 0 : val) + * this.left = (left===undefined ? null : left) + * this.right = (right===undefined ? null : right) + * } + */ +/** + * @param {TreeNode} root + * @param {TreeNode[]} list + * @return {void} Do not return anything, modify root in-place instead. + */ +var inOrder = function (root, list) { + if (!root) return null + + inOrder(root.left, list) + list.push(root) + inOrder(root.right, list) +} +``` diff --git "a/src/leetcode/javascript/medium/96.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" "b/src/leetcode/javascript/medium/96.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" index 0ca0f335..395a7bb0 100644 --- "a/src/leetcode/javascript/medium/96.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" +++ "b/src/leetcode/javascript/medium/96.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" @@ -9,5 +9,17 @@ * @param {number} n * @return {number} */ -var numTrees = function (n) {} +var numTrees = function (n) { + const dp = new Array(n + 1).fill(0) + dp[0] = 1 + dp[1] = 1 + + for (let i = 2; i <= n; i++) { + for (let j = 1; j <= i; j++) { + dp[i] += dp[j - 1] * dp[i - j] + } + } + + return dp[n] +} // @lc code=end diff --git "a/src/leetcode/javascript/medium/99.\346\201\242\345\244\215\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" "b/src/leetcode/javascript/medium/99.\346\201\242\345\244\215\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" new file mode 100644 index 00000000..05f559b8 --- /dev/null +++ "b/src/leetcode/javascript/medium/99.\346\201\242\345\244\215\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.js" @@ -0,0 +1,60 @@ +/* + * @lc app=leetcode.cn id=99 lang=javascript + * + * [99] 恢复二叉搜索树 + */ + +// @lc code=start +/** + * Definition for a binary tree node. + * function TreeNode(val, left, right) { + * this.val = (val===undefined ? 0 : val) + * this.left = (left===undefined ? null : left) + * this.right = (right===undefined ? null : right) + * } + */ +/** + * @param {TreeNode} root + * @return {void} Do not return anything, modify root in-place instead. + */ +var recoverTree = function (root) { + const list = [] + inOrder(root, list) + let x = null + let y = null + + for (let i = 0; i < list.length - 1; i++) { + if (list[i].val > list[i + 1].val) { + y = list[i + 1] + if (!x) x = list[i] + } + } + + if (x && y) { + const tmp = x.val + x.val = y.val + y.val = tmp + } +} + +/** + * Definition for a binary tree node. + * function TreeNode(val, left, right) { + * this.val = (val===undefined ? 0 : val) + * this.left = (left===undefined ? null : left) + * this.right = (right===undefined ? null : right) + * } + */ +/** + * @param {TreeNode} root + * @param {TreeNode[]} list + * @return {void} Do not return anything, modify root in-place instead. + */ +var inOrder = function (root, list) { + if (!root) return null + + inOrder(root.left, list) + list.push(root) + inOrder(root.right, list) +} +// @lc code=end diff --git a/src/leetcode/rust/src/medium/mod.rs b/src/leetcode/rust/src/medium/mod.rs index 3594efb6..4b4e578e 100644 --- a/src/leetcode/rust/src/medium/mod.rs +++ b/src/leetcode/rust/src/medium/mod.rs @@ -1,5 +1,4 @@ pub mod question_11; -pub mod question_2; pub mod question_1143; pub mod question_12; pub mod question_120; @@ -11,6 +10,7 @@ pub mod question_16; pub mod question_17; pub mod question_19; pub mod question_198; +pub mod question_2; pub mod question_213; pub mod question_215; pub mod question_22; @@ -87,4 +87,5 @@ pub mod question_90; pub mod question_91; pub mod question_926; pub mod question_93; -pub mod question_97; \ No newline at end of file +pub mod question_97; +pub mod question_99; \ No newline at end of file diff --git a/src/leetcode/rust/src/medium/question_99.rs b/src/leetcode/rust/src/medium/question_99.rs new file mode 100644 index 00000000..1c483194 --- /dev/null +++ b/src/leetcode/rust/src/medium/question_99.rs @@ -0,0 +1 @@ +pub fn foo() -> () {} \ No newline at end of file diff --git a/static/img/99-recover-tree-1.jpg b/static/img/99-recover-tree-1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f95ab3f0c40047fa1977023b16825ce96a6a38f2 GIT binary patch literal 14332 zcmeHuXH-SQ6xi?1cWAtWN4C-nIZ4i; z$vGoAXMx9l_w0N2xo@9)&K={uf3MaUHL7aWs+z0Ttg1P``qs_(%{+iq;T7Z+01FEM zz`DHvH&Xy<01o!=;rAHlHsIdD{XG!exr29ykl^lJLIOg65W4rpY*|Pn)LTZuzr6M2bbXXLDGAK_iju7hvB9XKt_PYjg^6e#R$MA!@?oM zx@iH>{VpmF*6#uEw?J?QpAZih3kUo5wgM^O_l~h|g}!qKp8)6gx4O;X-KNRzKY75& zLnx*Cj-2AfO9w~FM@(wQMGu*Ig`_boCLeuEN{6Y~_ynC?+=iT8i*MVaz3l?~_pbiv z2mrt*z{b0SgZsN6!eqDOg^hEY#ly$@j~ZCmWWRTH{|S#2{sYx_4j&oAzmvZxYFeP6 zWHR<0+!I&7}>~7Y0;_R_YsBS3{hJYd<9`qG9A(a1(=;XwlCf&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=?vn=7AcR|l;~_9$4OTxi*!10nm@7&PQy(9guVULgSZd| z2B&C4p4hMSy?5GxaFobMszog&y{KE=jt8V3){m%vF{=PbH2U7* z(w;`dzvrOe5`q5nCyalR`oBzO^oxkUnqB3If`6W}?c_e!EKuO-LgGL3c}D(1zaSEX z)t3f~(i!idc84QXmjme|8t)d4XKa*D0 zs&b}%sdQYEs5)kj)J?%={O^Dezc}%UyNW08wbLgx1E%I2s$1#Cp5$aAYf>{|8NPzy zd)!`rSHpT3t1X(KF=eHh?XJ%%pEZgqDRGwCXeYM$oTx@LOX;OdN2IeeKionbM=}%# zf8OAl$_nHPXFM>9v(XkB=6YtUz>l1O{cJWncQm8J<%?H)|AC~^VSTR&?&kAjPoF&5 zwI$O#h%*o30gw8al&>7wJSj@1nAOxCXWB}m}o)jcZncAl2Ztg=1TH_mQjBT7EP$2J|EQrc$vGKtO%SAWw-a6m5v z!WG63&%Q`T?IKw6rt)WOBh=Ru!70gaj)4h2KitKy@+WTqkhCuzMob=-u+!4>&1ng; z_UE+F5r1RK7*LcR3$wEZ-2BPzHuH!1X{~&RZyE_#zK-2>So)pl z=T2;CdA#G>A=?xDuRrj0>A(JhxOCiES-vPj4s=G?!*}m)DVO$eodIEP<`V#LIg-lC zCv&-GwiE8US)rFUd|{#TG;>%?I+LL=iKGEu-Y^7Xrq}M6g;INOi@!IB*B(=Dxr>O} zb!p>BFt)$_k44g+RoSMrZ%CLJjrO46Cz?k-S@Io_j#Lg>I4j2qd$agZOG4VTc#4s9 k=*{5E@$aAfrm4l2PuYfVe}e>3sF0MAVJBme*a literal 0 HcmV?d00001 diff --git a/static/img/99-recover-tree-2.jpg b/static/img/99-recover-tree-2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f23c1e9da5e3510c34df4e65aee2d029109cadba GIT binary patch literal 19255 zcmb5V1z20n+BF=Cmtt*^;spwY5?Wdu0_C9;DDDo$-Q6h^DH5!N;_eQ?trT|&L4yV< z0fM`I^t|$&bG~!_|9vOdH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%Xfa8v4%+dy#_>$+SytM_VL z_sR~t$A)K~(nOsL?(`5YI5JBy8Nt2mFkjwvbZT1f}^UfS@uUM(j$<`=H0YYYsuQvF_ zajOPmiA*pV7h#qgAT)PzK1n{e=wU1>)>x&zk&Z4pgS{nx5Z*z;QoiFy*9ZL)9g4$L ztvo5Y-}s@3GsE-pu9WQ?dI<4_gxYZ*v%Y$ib@lKmHK^O5&PZ8NQ0IyoLOkvkPoyuV zMefQxRL+UdUi`>jvx*|Ekq`lcpmr&nNc@ttg6^W!EG7uT{V5CAX_AUUcA_~*bLK&PZ!y+ ziJbNt{QfNT05v<1czgYAa!$61^u!puBIaZSx(4@iZ>@!*-#Xun{t0mK<^&ebpbiB>^9qDbBp-x% zk_8^(pg+O_kfxGsD7?)R(M93>SK2ZVCN+04yJ-)#(MThHAO$uGfS|HQ=LZP`~gRf-}u-txG@@t>^pno*%~u;tyEbs$l^9HNu%c z)n9B0cUbg6eK}VG{Yb?d9CJ8>QB||W$z&lyD78~+e9$o90|*QSaiQwWfvY=%W;OW< z^vtR#Sza{W9s#|N48NA1M#vxu-8Nf|(D0-y6O@Iz{?d=rJl<*+nlsH%nY@+<)9?Kq z{Uz(i`1QlL9%@b~&407|Ix}d#14XCBF?h0!68jBZbJ*59ebb8dBtr27$lnp4G_1kp zV7E2R+J7VN7|Cl?^h!8lhL4wtK<{Efyf}HoXZ6T-OCF_PcUv-udOY=JusyFcrV(mV%Sv2G%D2sNk`I$O<5e^-*Y=3*Dbr4n X;mJ0I6I=QD4c!sZ_&>}#^;6HE$Y$6Q literal 0 HcmV?d00001 From a7a8dd862163a88fb064b2a50e97534d247674c3 Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Wed, 15 Nov 2023 17:17:59 +0800 Subject: [PATCH 6/8] style: format code --- leetcode-docs/hard/10-is-match.mdx | 1 + leetcode-docs/hard/115-num-distinct.mdx | 1 + leetcode-docs/hard/44-is-match.mdx | 1 + leetcode-docs/hard/72-min-distance.mdx | 1 + .../1143-longest-common-subsequence.mdx | 7 +- leetcode-docs/medium/36-is-valid-sudoku.mdx | 2 +- .../medium/516-longest-palindrome-subseq.mdx | 83 +++++++++++++++++++ leetcode-docs/medium/583-min-distance.mdx | 1 + leetcode-docs/medium/80-remove-duplicates.mdx | 2 +- leetcode-docs/medium/95-generate-trees.mdx | 2 +- leetcode-docs/medium/96-num-trees.mdx | 2 +- leetcode-docs/medium/99-recover-tree.mdx | 14 ++-- ...07\345\255\220\345\272\217\345\210\227.js" | 31 +++++++ src/leetcode/rust/src/medium/mod.rs | 1 + src/leetcode/rust/src/medium/question_516.rs | 1 + 15 files changed, 136 insertions(+), 14 deletions(-) create mode 100644 leetcode-docs/medium/516-longest-palindrome-subseq.mdx create mode 100644 "src/leetcode/javascript/medium/516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.js" create mode 100644 src/leetcode/rust/src/medium/question_516.rs diff --git a/leetcode-docs/hard/10-is-match.mdx b/leetcode-docs/hard/10-is-match.mdx index c8008a93..80a21653 100644 --- a/leetcode-docs/hard/10-is-match.mdx +++ b/leetcode-docs/hard/10-is-match.mdx @@ -14,6 +14,7 @@ keywords: - [44. 通配符匹配](/leetcode/hard/44-is-match) - [72. 编辑距离](/leetcode/hard/72-min-distance) - [115. 不同的子序列](/leetcode/hard/115-num-distinct) +- [516. 最长回文子序列](/leetcode/medium/516-longest-palindrome-subseq) - [583. 两个字符串的删除操作](/leetcode/medium/583-min-distance) - [1143. 最长公共子序列](/leetcode/medium/1143-longest-common-subsequence) diff --git a/leetcode-docs/hard/115-num-distinct.mdx b/leetcode-docs/hard/115-num-distinct.mdx index 20633ccb..09a4abc4 100644 --- a/leetcode-docs/hard/115-num-distinct.mdx +++ b/leetcode-docs/hard/115-num-distinct.mdx @@ -14,6 +14,7 @@ keywords: - [10. 正则表达式匹配](/leetcode/hard/10-is-match) - [44. 通配符匹配](/leetcode/hard/44-is-match) - [72. 编辑距离](/leetcode/hard/72-min-distance) +- [516. 最长回文子序列](/leetcode/medium/516-longest-palindrome-subseq) - [583. 两个字符串的删除操作](/leetcode/medium/583-min-distance) - [1143. 最长公共子序列](/leetcode/medium/1143-longest-common-subsequence) diff --git a/leetcode-docs/hard/44-is-match.mdx b/leetcode-docs/hard/44-is-match.mdx index ed5f0ab0..3f9c3d34 100644 --- a/leetcode-docs/hard/44-is-match.mdx +++ b/leetcode-docs/hard/44-is-match.mdx @@ -14,6 +14,7 @@ keywords: - [10. 正则表达式匹配](/leetcode/hard/10-is-match) - [72. 编辑距离](/leetcode/hard/72-min-distance) - [115. 不同的子序列](/leetcode/hard/115-num-distinct) +- [516. 最长回文子序列](/leetcode/medium/516-longest-palindrome-subseq) - [583. 两个字符串的删除操作](/leetcode/medium/583-min-distance) - [1143. 最长公共子序列](/leetcode/medium/1143-longest-common-subsequence) diff --git a/leetcode-docs/hard/72-min-distance.mdx b/leetcode-docs/hard/72-min-distance.mdx index 5402a639..4e75246a 100644 --- a/leetcode-docs/hard/72-min-distance.mdx +++ b/leetcode-docs/hard/72-min-distance.mdx @@ -14,6 +14,7 @@ keywords: - [10. 正则表达式匹配](/leetcode/hard/10-is-match) - [44. 通配符匹配](/leetcode/hard/44-is-match) - [115. 不同的子序列](/leetcode/hard/115-num-distinct) +- [516. 最长回文子序列](/leetcode/medium/516-longest-palindrome-subseq) - [583. 两个字符串的删除操作](/leetcode/medium/583-min-distance) - [1143. 最长公共子序列](/leetcode/medium/1143-longest-common-subsequence) diff --git a/leetcode-docs/medium/1143-longest-common-subsequence.mdx b/leetcode-docs/medium/1143-longest-common-subsequence.mdx index fae0b76d..71a79c71 100644 --- a/leetcode-docs/medium/1143-longest-common-subsequence.mdx +++ b/leetcode-docs/medium/1143-longest-common-subsequence.mdx @@ -15,6 +15,7 @@ keywords: - [44. 通配符匹配](/leetcode/hard/44-is-match) - [72. 编辑距离](/leetcode/hard/72-min-distance) - [115. 不同的子序列](/leetcode/hard/115-num-distinct) +- [516. 最长回文子序列](/leetcode/medium/516-longest-palindrome-subseq) - [583. 两个字符串的删除操作](/leetcode/medium/583-min-distance) ::: @@ -66,7 +67,7 @@ keywords: 一般要构造如下 `dp` 二维数组, 即让 `dp[0][0]` 为 `0`. 那么从索引 `1` 开始, `dp[i][j]` 的含义就是: `s1[1..i]` 和 `s2[1..j]`, 它们的最长公共子序列是 `dp[i][j]`. -对于下面这个例子, `dp[2][4]` 的含义就是对于 `ac` 和 `babc` 这两个子字符串, 它们的最长公共子序列是 `2`, 当然我们求这个题的结果即是求 `dp[3][6]`. +对于下面这个例子, `dp[2][4]` 的含义就是对于 `ac` 和 `babc` 这两个子字符串, 它们的最长公共子序列是 `2`. ![1143-longest-common-subsequence](../../static/img/1143-longest-common-subsequence.png) @@ -77,8 +78,8 @@ keywords: ### 找状态转移方程 -对于这个问题, 状态转移就是在做选择, 即求 `s1` 和 `s2` 的最长公共子序列 `lcs`. 那么对于 `s1` 和 `s2` 中的每个字符, 要么在 `lcs` 中, 要么不在. -因此, 如果某个字符应该在 `lcs` 中, 那么这个字符肯定同时存在于 `s1` 和 `s2` 中; 否则, 至少有一个不在 `lcs` 中, 此时取最大的那个. 因此状态转移方程为: +对于这个问题, 状态转移就是在做选择, 即求 `s1` 和 `s2` 的最长公共子序列. 那么对于 `s1` 和 `s2` 中的每个字符, 要么在最长公共子序列中, 要么不在. +因此, 如果某个字符应该在最长公共子序列中, 那么这个字符肯定同时存在于 `s1` 和 `s2` 中; 否则, 至少有一个不在最长公共子序列中, 此时取最大的那个. 因此状态转移方程为: - 如果 `s[i - 1] === s[j - 1]`, 那么有 `dp[i][j] = dp[i - 1][j - 1] + 1` - 否则, `dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1])` diff --git a/leetcode-docs/medium/36-is-valid-sudoku.mdx b/leetcode-docs/medium/36-is-valid-sudoku.mdx index b5b802a8..f2f28548 100644 --- a/leetcode-docs/medium/36-is-valid-sudoku.mdx +++ b/leetcode-docs/medium/36-is-valid-sudoku.mdx @@ -18,7 +18,7 @@ keywords: - 数字 `1 - 9` 在每一列只能出现一次. - 数字 `1 - 9` 在每一个以粗实线分隔的 `3 * 3` 宫内只能出现一次. -注意: +注意: - 一个有效的数独(部分已被填充)不一定是可解的. - 只需要根据以上规则, 验证已经填入的数字是否有效即可. diff --git a/leetcode-docs/medium/516-longest-palindrome-subseq.mdx b/leetcode-docs/medium/516-longest-palindrome-subseq.mdx new file mode 100644 index 00000000..6f2d8596 --- /dev/null +++ b/leetcode-docs/medium/516-longest-palindrome-subseq.mdx @@ -0,0 +1,83 @@ +--- +id: 516-longest-palindrome-subseq +title: 最长回文子序列 +sidebar_label: 516. 最长回文子序列 +keywords: + - Dynamic Programming +--- + +:::success Tips +题目类型: Dynamic Programming + +相关题目: + +- [10. 正则表达式匹配](/leetcode/hard/10-is-match) +- [44. 通配符匹配](/leetcode/hard/44-is-match) +- [72. 编辑距离](/leetcode/hard/72-min-distance) +- [115. 不同的子序列](/leetcode/hard/115-num-distinct) +- [583. 两个字符串的删除操作](/leetcode/medium/583-min-distance) +- [1143. 最长公共子序列](/leetcode/medium/1143-longest-common-subsequence) + +::: + +## 题目 + +给你一个字符串 `s`, 找出其中最长的回文子序列, 并返回该序列的长度. + +子序列定义为: 不改变剩余字符顺序的情况下, 删除某些字符或者不删除任何字符形成的一个序列. + +:::note 提示: + +- `1 <= s.length <= 1000` +- `s` 仅由数字和英文字母组成 + +::: + +:::info 示例 + +```ts +输入: s = "bbbab" +输出: 4 +解释: 一个可能的最长回文子序列为 "bbbb" +``` + +```ts +输入: s = "cbbd" +输出: 2 +解释: 一个可能的最长回文子序列为 "bb" +``` + +::: + +## 题解 + +对于一个子序列而言, 如果它是回文子序列, 并且长度大于 2, 那么将它首尾的两个字符去除之后, 它仍然是个回文子序列. + +```ts +/** + * @param {string} s + * @return {number} + */ +var longestPalindromeSubseq = function (s) { + const n = s.length + const dp = new Array(n + 1).fill(0).map(() => new Array(n + 1).fill(0)) + + // 反着遍历保证正确的状态转移 + for (let i = n - 1; i >= 0; i--) { + // 如果只有一个字符, 一定是回文 + dp[i][i] = 1 + + const char1 = s[i] + for (let j = i + 1; j < n; j++) { + const char2 = s[j] + if (char1 === char2) { + dp[i][j] = dp[i + 1][j - 1] + 2 + } else { + dp[i][j] = Math.max(dp[i + 1][j], dp[i][j - 1]) + } + } + } + + return dp[0][n - 1] +} +``` diff --git a/leetcode-docs/medium/583-min-distance.mdx b/leetcode-docs/medium/583-min-distance.mdx index 73752566..ccae8461 100644 --- a/leetcode-docs/medium/583-min-distance.mdx +++ b/leetcode-docs/medium/583-min-distance.mdx @@ -15,6 +15,7 @@ keywords: - [44. 通配符匹配](/leetcode/hard/44-is-match) - [72. 编辑距离](/leetcode/hard/72-min-distance) - [115. 不同的子序列](/leetcode/hard/115-num-distinct) +- [516. 最长回文子序列](/leetcode/medium/516-longest-palindrome-subseq) - [1143. 最长公共子序列](/leetcode/medium/1143-longest-common-subsequence) ::: diff --git a/leetcode-docs/medium/80-remove-duplicates.mdx b/leetcode-docs/medium/80-remove-duplicates.mdx index 20a14374..503e20be 100644 --- a/leetcode-docs/medium/80-remove-duplicates.mdx +++ b/leetcode-docs/medium/80-remove-duplicates.mdx @@ -81,7 +81,7 @@ var removeDuplicates = function (nums) { -对于此类问题, 为了让解法更具有一般性,我们将原问题的**保留 `2` 位**修改为**保留 `k` 位**, 我们应该进行如下考虑: +对于此类问题, 为了让解法更具有一般性, 我们将原问题的**保留 `2` 位**修改为**保留 `k` 位**, 我们应该进行如下考虑: - 由于是保留 `k` 个相同数字, 对于前 `k` 个数字, 我们可以直接保留 - 对于后面的任意数字, 能够保留的前提是: 与当前写入的位置前面的第 `k` 个元素进行比较, 不相同则保留 diff --git a/leetcode-docs/medium/95-generate-trees.mdx b/leetcode-docs/medium/95-generate-trees.mdx index d707eb6d..2cfd5d86 100644 --- a/leetcode-docs/medium/95-generate-trees.mdx +++ b/leetcode-docs/medium/95-generate-trees.mdx @@ -81,5 +81,5 @@ var generateTrees = function (n) { ## 复杂度分析 -- 时间复杂度:卡特兰数 +- 时间复杂度: 卡特兰数 - 空间复杂度: 卡特兰数 diff --git a/leetcode-docs/medium/96-num-trees.mdx b/leetcode-docs/medium/96-num-trees.mdx index b58ed937..284d32dd 100644 --- a/leetcode-docs/medium/96-num-trees.mdx +++ b/leetcode-docs/medium/96-num-trees.mdx @@ -38,7 +38,7 @@ keywords: ## 题解 -给定一个有序序列 `1` 到 `n`,为了构建出一棵二叉搜索树, 我们可以遍历每个数字 `i`, 将该数字作为树根, 将 `1` 到 `i - 1` 序列作为左子树,将 `i + 1` 到 `n` 序列作为右子树. +给定一个有序序列 `1` 到 `n`,为了构建出一棵二叉搜索树, 我们可以遍历每个数字 `i`, 将该数字作为树根, 将 `1` 到 `i - 1` 序列作为左子树, 将 `i + 1` 到 `n` 序列作为右子树. 接着我们可以按照同样的方式递归构建左子树和右子树. ```ts diff --git a/leetcode-docs/medium/99-recover-tree.mdx b/leetcode-docs/medium/99-recover-tree.mdx index 4533e707..54a93def 100644 --- a/leetcode-docs/medium/99-recover-tree.mdx +++ b/leetcode-docs/medium/99-recover-tree.mdx @@ -26,17 +26,17 @@ keywords: ![33-search](../../static/img/99-recover-tree-1.jpg) ```ts -输入:root = [1,3,null,null,2] -输出:[3,1,null,null,2] -解释:3 不能是 1 的左孩子,因为 3 > 1 。交换 1 和 3 使二叉搜索树有效。 +输入: root = [1,3,null,null,2] +输出: [3,1,null,null,2] +解释: 3 不能是 1 的左孩子, 因为 3 > 1 。交换 1 和 3 使二叉搜索树有效。 ``` ![33-search](../../static/img/99-recover-tree-2.jpg) ```ts -输入:root = [3,1,4,null,null,2] -输出:[2,1,4,null,null,3] -解释:2 不能在 3 的右子树中,因为 2 < 3 。交换 2 和 3 使二叉搜索树有效。 +输入: root = [3,1,4,null,null,2] +输出: [2,1,4,null,null,3] +解释: 2 不能在 3 的右子树中, 因为 2 < 3 。交换 2 和 3 使二叉搜索树有效。 ``` ::: @@ -44,7 +44,7 @@ keywords: ## 题解 1. 由于是 BST, 所以使用中序遍历, 把所有节点存储到 `list` 中 -2. 遍历这个列表 `list`, 由于 BST 的中序遍历应当是从小到大排列的, 所以如果前面的 val 大于了后面的 val, 说明后面这个应当靠前. +2. 遍历这个列表 `list`, 由于 BST 的中序遍历应当是从小到大排列的, 所以如果前面的 `val` 大于了后面的 `val`, 说明后面这个应当靠前. 3. 找到两个需要交换的, 交换他们的值即可 ```ts diff --git "a/src/leetcode/javascript/medium/516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.js" "b/src/leetcode/javascript/medium/516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.js" new file mode 100644 index 00000000..397572cd --- /dev/null +++ "b/src/leetcode/javascript/medium/516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.js" @@ -0,0 +1,31 @@ +/* + * @lc app=leetcode.cn id=516 lang=javascript + * + * [516] 最长回文子序列 + */ + +// @lc code=start +/** + * @param {string} s + * @return {number} + */ +var longestPalindromeSubseq = function (s) { + const n = s.length + const dp = new Array(n + 1).fill(0).map(() => new Array(n + 1).fill(0)) + + for (let i = n - 1; i >= 0; i--) { + dp[i][i] = 1 + const char1 = s[i] + for (let j = i + 1; j < n; j++) { + const char2 = s[j] + if (char1 === char2) { + dp[i][j] = dp[i + 1][j - 1] + 2 + } else { + dp[i][j] = Math.max(dp[i + 1][j], dp[i][j - 1]) + } + } + } + + return dp[0][n - 1] +} +// @lc code=end diff --git a/src/leetcode/rust/src/medium/mod.rs b/src/leetcode/rust/src/medium/mod.rs index 4b4e578e..7ca3f486 100644 --- a/src/leetcode/rust/src/medium/mod.rs +++ b/src/leetcode/rust/src/medium/mod.rs @@ -46,6 +46,7 @@ pub mod question_494; pub mod question_5; pub mod question_50; pub mod question_503; +pub mod question_516; pub mod question_518; pub mod question_528; pub mod question_53; diff --git a/src/leetcode/rust/src/medium/question_516.rs b/src/leetcode/rust/src/medium/question_516.rs new file mode 100644 index 00000000..1c483194 --- /dev/null +++ b/src/leetcode/rust/src/medium/question_516.rs @@ -0,0 +1 @@ +pub fn foo() -> () {} \ No newline at end of file From f9b14a0726964a75283137e6c5145344b45b6463 Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Wed, 15 Nov 2023 19:41:58 +0800 Subject: [PATCH 7/8] feat: finish 91-num-decodings --- leetcode-docs/medium/91-num-decodings.mdx | 52 +++++++++---------- ...43\347\240\201\346\226\271\346\263\225.js" | 22 +++++++- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/leetcode-docs/medium/91-num-decodings.mdx b/leetcode-docs/medium/91-num-decodings.mdx index cf236d61..ec75684f 100644 --- a/leetcode-docs/medium/91-num-decodings.mdx +++ b/leetcode-docs/medium/91-num-decodings.mdx @@ -26,7 +26,7 @@ keywords: - `"AAJF"`, 将消息分组为 `(1 1 10 6)` - `"KJF"`, 将消息分组为 `(11 10 6)` -注意, 消息不能分组为 `(1 11 06)`, 因为 `"06"` 不能映射为 `"F"`, 这是由于 `"6"` 和 `"06"` 在映射中并不等价. +注意, 消息不能分组为 `(1 11 06)`, 因为 `"06"` 不能映射为 `"F"`, 这是由于 `"6"` 和 `"06"` 在映射中并不等价. 给你一个只含数字的**非空**字符串 `s`, 请计算并返回**解码**方法的**总数**. @@ -44,51 +44,49 @@ keywords: ```bash 输入: s = "12" 输出: 2 -解释: 它可以解码为 "AB"(1 2) 或者 "L"(12). +解释: 它可以解码为 "AB"(1 2) 或者 "L"(12). ``` ```bash 输入: s = "226" 输出: 3 -解释: 它可以解码为 "BZ"(2 26), "VF"(22 6), 或者 "BBF"(2 2 6). +解释: 它可以解码为 "BZ"(2 26), "VF"(22 6), 或者 "BBF"(2 2 6). ``` ```bash 输入: s = "06" 输出: 0 -解释: "06" 无法映射到 "F", 因为存在前导零("6" 和 "06" 并不等价). +解释: "06" 无法映射到 "F", 因为存在前导零("6" 和 "06" 并不等价). ``` ::: ## 题解 -这里是题解这里是题解这里是题解这里是题解这里是题解 - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - - - - ```ts - /** * @param {string} s * @return {number} */ -var numDecodings = function(s) { - -}; - +var numDecodings = function (s) { + const n = s.length + const dp = new Array(n + 1).fill(0) + dp[0] = 1 + + for (let i = 1; i <= n; i++) { + if (s[i - 1] !== '0') { + dp[i] += dp[i - 1] + } + + if ( + i > 1 && + s[i - 2] !== '0' && + Number(s[i - 2]) * 10 + Number(s[i - 1]) <= 26 + ) { + dp[i] += dp[i - 2] + } + } + + return dp[n] +} ``` - - - - -```rust -pub fn num_decodings(s: String) -> i32 {} -``` - - - diff --git "a/src/leetcode/javascript/medium/91.\350\247\243\347\240\201\346\226\271\346\263\225.js" "b/src/leetcode/javascript/medium/91.\350\247\243\347\240\201\346\226\271\346\263\225.js" index 916d3734..aa7a479d 100644 --- "a/src/leetcode/javascript/medium/91.\350\247\243\347\240\201\346\226\271\346\263\225.js" +++ "b/src/leetcode/javascript/medium/91.\350\247\243\347\240\201\346\226\271\346\263\225.js" @@ -9,5 +9,25 @@ * @param {string} s * @return {number} */ -var numDecodings = function (s) {} +var numDecodings = function (s) { + const n = s.length + const dp = new Array(n + 1).fill(0) + dp[0] = 1 + + for (let i = 1; i <= n; i++) { + if (s[i - 1] !== '0') { + dp[i] += dp[i - 1] + } + + if ( + i > 1 && + s[i - 2] !== '0' && + Number(s[i - 2]) * 10 + Number(s[i - 1]) <= 26 + ) { + dp[i] += dp[i - 2] + } + } + + return dp[n] +} // @lc code=end From bee3eb5f44b7061f3c9b48e5ec1012a7b2b6e95f Mon Sep 17 00:00:00 2001 From: YanceyOfficial Date: Fri, 17 Nov 2023 15:13:44 +0800 Subject: [PATCH 8/8] feat: update 92-reverse-between --- leetcode-docs/medium/92-reverse-between.mdx | 69 ++------------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/leetcode-docs/medium/92-reverse-between.mdx b/leetcode-docs/medium/92-reverse-between.mdx index e06f194d..3c1fd5ec 100644 --- a/leetcode-docs/medium/92-reverse-between.mdx +++ b/leetcode-docs/medium/92-reverse-between.mdx @@ -38,44 +38,7 @@ keywords: ## 题解 -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - - - - -在做这道题之前, 先整个前菜, 也就是**反转链表前 N 个节点**, 这个题跟 [206. 反转链表](/leetcode/easy/206-reverse-list) 差不多, 因为是反转前 N 个, 因此得把第 N + 1 个节点记录下来, 以拼接在反转子链表之后. - ```ts -let successor = null // 后驱节点 - -/** - * Definition for singly-linked list. - * function ListNode(val) { - * this.val = val; - * this.next = null; - * } - */ -/** - * @param {ListNode} head - * @param {number} n - * @return {ListNode} - */ -var reverseN = function (head, n) { - if (n === 1) { - // 记录第 n + 1 个节点 - successor = head.next - return head - } - // 以 head.next 为起点, 需要反转前 n - 1 个节点 - const last = reverseN(head.next, n - 1) - - head.next.next = head - // 让反转之后的 head 节点和后面的节点连起来 - head.next = successor - return last -} - /** * Definition for singly-linked list. * function ListNode(val) { @@ -89,26 +52,6 @@ var reverseN = function (head, n) { * @param {number} n * @return {ListNode} */ -var reverseBetween = function (head, m, n) { - // 如果 m === 1, 就相当于反转链表开头的 n 个元素 - if (m === 1) { - return reverseN(head, n) - } - // 前进到反转的起点触发 base case - head.next = reverseBetween(head.next, m - 1, n - 1) - return head -} -``` - - - - -- 先创建一个 `dummyHead`, 它的 `next` 指向 `head`; -- 分别创建两个节点 `g(guard 节点)` 和 `p(point 节点)`. 其中前者指向 `dummyHead`, 后者指向 `dummyHead.next`; -- 以 m = 2, n = 4 为例, 将 g 移动到**第一个要反转的节点的前面**, 即节点 1; 将 p 移动到**第一个要反转的节点的位置上**, 即节点 2; -- 接下来是使用"头插法", 将 `p` 后面的去掉, 然后添加到 `g` 的后面. - -```ts var reverseBetween = function (head, m, n) { const dummyHead = new ListNode(0) dummyHead.next = head @@ -116,21 +59,19 @@ var reverseBetween = function (head, m, n) { let g = dummyHead, p = dummyHead.next - for (let step = 0; step < m - 1; step++) { + // 先找到需要反转的起点 + for (let i = 0; i < m - 1; i++) { g = g.next p = p.next } for (let i = 0; i < n - m; i++) { const removed = p.next - p.next = p.next.next // 将要反转的节点去掉, 比如去掉 3, 此时 p 成了 2 -> 4 -> 5 - removed.next = g.next // removed 此时为 3 -> 4 -> 5, 将 g.next 移过来, 成了 3 -> 2 -> 4 -> 5 - g.next = removed // 将新的 remove 放到 g.next 即可 + p.next = p.next.next + removed.next = g.next + g.next = removed } return dummyHead.next } ``` - - -