Skip to content

Commit 2007b77

Browse files
committed
feat: add solutions to lc problems: No.2404~2407
* No.2404.Most Frequent Even Element * No.2405.Optimal Partition of String * No.2406.Divide Intervals Into Minimum Number of Groups * No.2407.Longest Increasing Subsequence II
1 parent 105a4af commit 2007b77

File tree

46 files changed

+2304
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2304
-25
lines changed

lcci/03.03.Stack of Plates/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
</pre>
2424

2525
## 解法
26+
2627
<!-- 这里可写通用的实现逻辑 -->
2728

2829
<!-- tabs:start -->
@@ -34,6 +35,7 @@
3435
```python
3536

3637
```
38+
3739
### **Java**
3840

3941
<!-- 这里可写当前语言的特殊实现逻辑 -->

solution/0300-0399/0336.Palindrome Pairs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
<strong>输出:</strong>[[0,1],[1,0]]
3333
</pre>
3434

35-
36-
3735
<p><strong>提示:</strong></p>
3836

3937
<ul>

solution/0400-0499/0484.Find Permutation/Solution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ def findPermutation(self, s: str) -> List[int]:
77
j = i
88
while j < n and s[j] == 'D':
99
j += 1
10-
ans[i: j + 1] = ans[i: j + 1][::-1]
10+
ans[i : j + 1] = ans[i : j + 1][::-1]
1111
i = max(i + 1, j)
1212
return ans

solution/0500-0599/0554.Brick Wall/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
<strong>输出:</strong>3
2929
</pre>
3030

31-
32-
3331
<p><strong>提示:</strong></p>
3432

3533
<ul>

solution/0500-0599/0576.Out of Boundary Paths/Solution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
class Solution:
2-
def findPaths(self, m: int, n: int, maxMove: int, startRow: int, startColumn: int) -> int:
2+
def findPaths(
3+
self, m: int, n: int, maxMove: int, startRow: int, startColumn: int
4+
) -> int:
35
@cache
46
def dfs(i, j, k):
57
if i < 0 or j < 0 or i >= m or j >= n:

solution/0700-0799/0775.Global and Local Inversions/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
<strong>解释:</strong>有 2 个全局倒置,和 1 个局部倒置。
4343
</pre>
4444

45-
46-
4745
<p><strong>提示:</strong></p>
4846

4947
<ul>

solution/0700-0799/0776.Split BST/Solution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# self.left = left
66
# self.right = right
77
class Solution:
8-
def splitBST(self, root: Optional[TreeNode], target: int) -> List[Optional[TreeNode]]:
8+
def splitBST(
9+
self, root: Optional[TreeNode], target: int
10+
) -> List[Optional[TreeNode]]:
911
def dfs(root):
1012
if root is None:
1113
return [None, None]

solution/0800-0899/0830.Positions of Large Groups/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
<strong>输出:</strong>[]
4949
</pre>
5050

51-
52-
5351
<p><strong>提示:</strong></p>
5452

5553
<ul>

solution/0800-0899/0857.Minimum Cost to Hire K Workers/Solution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
class Solution:
2-
def mincostToHireWorkers(self, quality: List[int], wage: List[int], k: int) -> float:
2+
def mincostToHireWorkers(
3+
self, quality: List[int], wage: List[int], k: int
4+
) -> float:
35
t = sorted(zip(quality, wage), key=lambda x: x[1] / x[0])
46
ans, tot = inf, 0
57
h = []

solution/1000-1099/1032.Stream of Characters/Solution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def search(self, w):
2525

2626

2727
class StreamChecker:
28-
2928
def __init__(self, words: List[str]):
3029
self.trie = Trie()
3130
self.s = []
@@ -36,6 +35,7 @@ def query(self, letter: str) -> bool:
3635
self.s.append(letter)
3736
return self.trie.search(self.s[-201:])
3837

38+
3939
# Your StreamChecker object will be instantiated and called as such:
4040
# obj = StreamChecker(words)
4141
# param_1 = obj.query(letter)

0 commit comments

Comments
 (0)