Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Nov 3, 2023
1 parent c4dcbfb commit 19a511c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion leetcode-docs/hard/10-is-match.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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] === '*') {
Expand Down
13 changes: 6 additions & 7 deletions leetcode-docs/hard/25-reverse-k-group.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions leetcode-docs/hard/30-find-substring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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` 由小写英文字母组成
Expand Down Expand Up @@ -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 中都没有子字符串, 可以提前终止
Expand Down

0 comments on commit 19a511c

Please sign in to comment.