Skip to content

Commit 32f072b

Browse files
committed
Clean the codes
1 parent e4628da commit 32f072b

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ LeetCode
8383
| 171|[Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number/) | [Python](algorithms/171-excel-sheet-column-number.py)|Easy|
8484
| 169|[Majority Element](https://leetcode.com/problems/majority-element/) | [Python](algorithms/169-majority-element.py)|Easy|
8585
| 168|[Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-title/) | [Python](algorithms/168-excel-sheet-column-title.ipynb)|Easy|
86-
| 167|[Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/) ♥ | [Python](algorithms/167-two-sum-ii-input-array-is-sorted.ipynb)|Medium|
86+
| 167|[Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/) | [Python](algorithms/167-two-sum-ii-input-array-is-sorted.ipynb)|Medium|
8787
| 160|[Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists/) | [Python](algorithms/160-intersection-of-two-linked-lists.ipynb)|Easy|
8888
| 152|[Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/)| [Python](algorithms/152-maximum-product-subarray.py)|Medium|
8989
| 150|[Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/)| [Python](algorithms/150-evaluate-reverse-polish-notation.ipynb)|Medium|

algorithms/042-trapping-rain-water.go

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,12 @@ func trap(heights []int) int64 {
3535
}
3636

3737
ans := 0
38-
for i := 1; i < n -1; i++ {
39-
h := min(lefts[i], rights[i])
40-
if h > heights[i] {
41-
ans += h - heights[i]
42-
}
43-
}
38+
for i := 1; i < n-1; i++ {
39+
h := min(lefts[i], rights[i])
40+
if h > heights[i] {
41+
ans += h - heights[i]
42+
}
43+
}
4444

4545
return int64(ans)
4646
}
47-
48-
//
49-
//total, length = 0, len(heights)
50-
//if length <= 2:
51-
// return 0
52-
//max_left, max_right = [0 for _ in range(length)], [0 for _ in range(length)]
53-
//# max_left[0] = heights[0]
54-
//# max_right[length - 1] = heights[length - 1]
55-
//
56-
//for i in range(1, length):
57-
// max_left[i] = max(max_left[i - 1], heights[i - 1])
58-
//for i in reversed(range(0, length - 1)):
59-
// max_right[i] = max(max_right[i + 1], heights[i + 1])
60-
//
61-
//for i in range(1, length - 1):
62-
// m = min(max_left[i], max_right[i])
63-
// if m > heights[i]:
64-
// total += (m - heights[i])
65-
//
66-
//return total

0 commit comments

Comments
 (0)