Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1bc9bd3

Browse files
chore: update lc problems (doocs#4336)
1 parent 2e5b60f commit 1bc9bd3

File tree

15 files changed

+333
-39
lines changed

15 files changed

+333
-39
lines changed

‎solution/0100-0199/0184.Department Highest Salary/Solution.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ def department_highest_salary(
1717
result = top_earners[['name_y', 'name_x', 'salary']].copy()
1818
result.columns = ['Department', 'Employee', 'Salary']
1919

20-
return result
20+
return result

‎solution/0400-0499/0416.Partition Equal Subset Sum/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ impl Solution {
202202
let n = nums.len();
203203
let mut f = vec![vec![false; m + 1]; n + 1];
204204
f[0][0] = true;
205-
205+
206206
for i in 1..=n {
207207
let x = nums[i - 1] as usize;
208208
for j in 0..=m {
209209
f[i][j] = f[i - 1][j] || (j >= x && f[i - 1][j - x]);
210210
}
211211
}
212-
212+
213213
f[n][m]
214214
}
215215
}

‎solution/0400-0499/0416.Partition Equal Subset Sum/README_EN.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ impl Solution {
201201
let n = nums.len();
202202
let mut f = vec![vec![false; m + 1]; n + 1];
203203
f[0][0] = true;
204-
204+
205205
for i in 1..=n {
206206
let x = nums[i - 1] as usize;
207207
for j in 0..=m {
208208
f[i][j] = f[i - 1][j] || (j >= x && f[i - 1][j - x]);
209209
}
210210
}
211-
211+
212212
f[n][m]
213213
}
214214
}

‎solution/0400-0499/0416.Partition Equal Subset Sum/Solution.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ impl Solution {
88
let n = nums.len();
99
let mut f = vec![vec![false; m + 1]; n + 1];
1010
f[0][0] = true;
11-
11+
1212
for i in 1..=n {
1313
let x = nums[i - 1] as usize;
1414
for j in 0..=m {
1515
f[i][j] = f[i - 1][j] || (j >= x && f[i - 1][j - x]);
1616
}
1717
}
18-
18+
1919
f[n][m]
2020
}
2121
}

‎solution/0700-0799/0752.Open the Lock/Solution.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def next(s):
1717
s = set(deadends)
1818
if '0000' in s:
1919
return -1
20-
q = deque([('0000')])
20+
q = deque(['0000'])
2121
s.add('0000')
2222
ans = 0
2323
while q:

‎solution/0700-0799/0752.Open the Lock/Solution2.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def extend(m1, m2, q):
2727

2828
def bfs():
2929
m1, m2 = {"0000": 0}, {target: 0}
30-
q1, q2 = deque([('0000')]), deque([(target)])
30+
q1, q2 = deque(['0000']), deque([target])
3131
while q1 and q2:
3232
t = extend(m1, m2, q1) if len(q1) <= len(q2) else extend(m2, m1, q2)
3333
if t != -1:

‎solution/0700-0799/0773.Sliding Puzzle/Solution.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def f():
2929
if start == end:
3030
return 0
3131
vis = {start}
32-
q = deque([(start)])
32+
q = deque([start])
3333
ans = 0
3434
while q:
3535
ans += 1

‎solution/1200-1299/1237.Find Positive Integer Solution for a Given Equation/Solution.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""
2-
This is the custom function interface.
3-
You should not implement it, or speculate about its implementation
4-
class CustomFunction:
5-
# Returns f(x, y) for any given positive integers x and y.
6-
# Note that f(x, y) is increasing with respect to both x and y.
7-
# i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1)
8-
def f(self, x, y):
2+
This is the custom function interface.
3+
You should not implement it, or speculate about its implementation
4+
class CustomFunction:
5+
# Returns f(x, y) for any given positive integers x and y.
6+
# Note that f(x, y) is increasing with respect to both x and y.
7+
# i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1)
8+
def f(self, x, y):
99
1010
"""
1111

‎solution/1200-1299/1237.Find Positive Integer Solution for a Given Equation/Solution2.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""
2-
This is the custom function interface.
3-
You should not implement it, or speculate about its implementation
4-
class CustomFunction:
5-
# Returns f(x, y) for any given positive integers x and y.
6-
# Note that f(x, y) is increasing with respect to both x and y.
7-
# i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1)
8-
def f(self, x, y):
2+
This is the custom function interface.
3+
You should not implement it, or speculate about its implementation
4+
class CustomFunction:
5+
# Returns f(x, y) for any given positive integers x and y.
6+
# Note that f(x, y) is increasing with respect to both x and y.
7+
# i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1)
8+
def f(self, x, y):
99
1010
"""
1111

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
use std::collections::HashSet;
2-
3-
impl Solution {
4-
pub fn minimum_operations(nums: Vec<i32>) -> i32 {
5-
let mut s = HashSet::new();
6-
for i in (0..nums.len()).rev() {
7-
if !s.insert(nums[i]) {
8-
return (i / 3) as i32 + 1;
9-
}
10-
}
11-
0
12-
}
13-
}
1+
use std::collections::HashSet;
2+
3+
impl Solution {
4+
pub fn minimum_operations(nums: Vec<i32>) -> i32 {
5+
let mut s = HashSet::new();
6+
for i in (0..nums.len()).rev() {
7+
if !s.insert(nums[i]) {
8+
return (i / 3) as i32 + 1;
9+
}
10+
}
11+
0
12+
}
13+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /