Skip to content

Commit 86f5872

Browse files
committed
update 153 278
1 parent 530ff83 commit 86f5872

8 files changed

+26
-113
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ python problem.py https://www.lintcode.com/problem/92 -l cpp
4444
| [] | [blind75.md](./list/blind75.md) | 77/77 | - |
4545
| [] | [geekbang.md](./list/geekbang.md) | 55/55 | - |
4646
| [] | [leetcode101.md](./list/leetcode101.md) | 183/184 | 1 vip |
47-
| [🔲] | [9c-basic.md](./list/9c-basic.md) | 2/128 | 1 vip |
47+
| [🔲] | [9c-basic.md](./list/9c-basic.md) | 4/128 | 2 vips |
4848
| [🔲] | [9c-top.md](./list/9c-top.md) | 5/48 | - |
4949
| [🔲] | [leetcode-contest.md](./list/leetcode-contest.md) | 10/56 | - |
5050
| [🔲] | [leetcode-google.md](./list/leetcode-google.md) | 0/7 | - |
5151

52-
**Solved**: 457 problems
52+
**Solved**: 456 problems
5353

5454
## 类型/Category
5555

@@ -850,7 +850,7 @@ python problem.py https://www.lintcode.com/problem/92 -l cpp
850850

851851
## Other
852852

853-
| Link | Problem(132) | Solution | Tag | Time | Space | Ref |
853+
| Link | Problem(131) | Solution | Tag | Time | Space | Ref |
854854
| ----- | ----- | ----- | ----- | ----- | ----- | ----- |
855855
| [Leetcode-16](https://leetcode.com/problems/3sum-closest/) | 3Sum Closest | [c++](./leetcode/16.3sum-closest.cpp), [python3](./leetcode/16.3sum-closest.py) | Other | \- | \- | - |
856856
| [Leetcode-454](https://leetcode.com/problems/4sum-ii/) | 4Sum II | [c++](./leetcode/454.4sum-ii.cpp) | Other | \- | \- | - |
@@ -981,7 +981,6 @@ python problem.py https://www.lintcode.com/problem/92 -l cpp
981981
| [Lintcode-629](https://www.lintcode.com/problem/minimum-spanning-tree/) | Minimum Spanning Tree | [c++](./lintcode/629.minimum-spanning-tree.cpp), [python3](./lintcode/629.minimum-spanning-tree.py) | Other | \- | \- | - |
982982
| [Lintcode-31](https://www.lintcode.com/problem/partition-array/) | Partition Array | [python3](./lintcode/31.partition-array.py) | Other | \- | \- | - |
983983
| [Lintcode-618](https://www.lintcode.com/problem/search-graph-nodes/) | Search Graph Nodes | [c++](./lintcode/618.search-graph-nodes.cpp), [python3](./lintcode/618.search-graph-nodes.py) | Other | \- | \- | - |
984-
| [Lintcode-447](https://www.lintcode.com/problem/search-in-a-big-sorted-array/) | Search In A Big Sorted Array | [c++](./lintcode/447.search-in-a-big-sorted-array.cpp), [python3](./lintcode/447.search-in-a-big-sorted-array.py) | Other | \- | \- | - |
985984
| [Lintcode-382](https://www.lintcode.com/problem/triangle-count/) | Triangle Count | [c++](./lintcode/382.triangle-count.cpp), [python3](./lintcode/382.triangle-count.py) | Other | \- | \- | - |
986985
| [Lintcode-598](https://www.lintcode.com/problem/zombie-in-matrix/) | Zombie In Matrix | [c++](./lintcode/598.zombie-in-matrix.cpp), [python3](./lintcode/598.zombie-in-matrix.py) | Other | \- | \- | - |
987986

leetcode/153.find-minimum-in-rotated-sorted-array.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@
4646
class Solution {
4747
public:
4848
int findMin(vector<int>& nums) {
49-
int start = 0;
50-
int end = nums.size() - 1;
49+
int left = 0;
50+
int right = nums.size() - 1;
5151

52-
while (start < end) {
53-
int mid = start + (end - start) / 2;
52+
while (left < right) {
53+
int mid = left + (right - left) / 2;
5454

55-
if (nums[mid] < nums[end]) {
56-
end = mid;
55+
if (nums[mid] > nums[right]) {
56+
left = mid + 1;
5757
} else {
58-
start = mid + 1;
58+
right = mid;
5959
}
6060
}
6161

62-
return nums[start];
62+
return nums[left];
6363
}
6464
};

leetcode/153.find-minimum-in-rotated-sorted-array.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,14 @@
4545

4646
class Solution:
4747
def findMin(self, nums: List[int]) -> int:
48-
start = 0
49-
end = len(nums) - 1
50-
51-
while start < end:
52-
53-
mid = start + (end - start) // 2
54-
55-
if nums[mid] < nums[end]:
56-
end = mid
48+
n = len(nums)
49+
left = 0
50+
right = n - 1
51+
while left < right:
52+
mid = left + (right - left) // 2
53+
if nums[mid] > nums[right]:
54+
left = mid + 1
5755
else:
58-
start = mid + 1
56+
right = mid
5957

60-
return nums[start]
58+
return nums[left]

leetcode/278.first-bad-version.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Solution {
4141
public:
4242
int firstBadVersion(int n) {
4343
int left = 1;
44-
int right = n; // 由于int范围限制,不能使用开区间n + 1
44+
int right = n;
4545

4646
while (left < right) {
4747
int mid = left + (right - left) / 2;

lintcode/447.search-in-a-big-sorted-array.cpp

Lines changed: 0 additions & 49 deletions
This file was deleted.

lintcode/447.search-in-a-big-sorted-array.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

lintcode/447.search-in-a-big-sorted-array.vip

Whitespace-only changes.

list/9c-basic.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
3. https://www.lintcode.com/problem/classical-binary-search/
1111
4. https://www.lintcode.com/problem/first-position-of-target/
1212
5. https://www.lintcode.com/problem/last-position-of-target/
13-
- https://www.lintcode.com/problem/first-bad-version/
14-
- https://www.lintcode.com/problem/search-in-a-big-sorted-array/
15-
- https://www.lintcode.com/problem/find-minimum-in-rotated-sorted-array/
13+
6. https://leetcode.com/problems/first-bad-version/
14+
7. https://www.lintcode.com/problem/search-in-a-big-sorted-array/
15+
8. https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
16+
17+
1618
- https://www.lintcode.com/problem/search-a---matrix/
1719
- https://www.lintcode.com/problem/search-a---matrix-ii/
1820
- https://www.lintcode.com/problem/search-for-a-range/

0 commit comments

Comments
 (0)