You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: LevelReviewPage.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2245,7 +2245,7 @@ space: O(1) greedy, O(n) dp
2245
2245
2246
2246
2247
2247
2248
-
## Medium (224)
2248
+
## Medium (228)
2249
2249
**0. [Delete Digits.java](https://github.com/awangdev/LintCode/blob/master/Java/Delete%20Digits.java)** Level: Medium Tags: []
2250
2250
2251
2251
@@ -6816,6 +6816,48 @@ space: O(X), X = max wall width
6816
6816
6817
6817
---
6818
6818
6819
+
**224. [Target Sum.java](https://github.com/awangdev/LintCode/blob/master/Java/Target%20Sum.java)** Level: Medium Tags: [DFS, DP]
6820
+
6821
+
6822
+
// 如何想到从中间initialize
6823
+
6824
+
6825
+
6826
+
---
6827
+
6828
+
**225. [Maximum Size Subarray Sum Equals k.java](https://github.com/awangdev/LintCode/blob/master/Java/Maximum%20Size%20Subarray%20Sum%20Equals%20k.java)** Level: Medium Tags: [Hash Table, PreSum]
6829
+
6830
+
time: O(n)
6831
+
space: O(n)
6832
+
6833
+
#### Map<preSumValue, index>
6834
+
- use `Map<preSum value, index>` to store inline preSum and its index.
6835
+
-1. Build presum incline
6836
+
-2. Use map to cache current preSum value and its index: `Map<preSum value, index>`
6837
+
-3. Each iteration: calculate possible preSum candidate that prior target sequence. ex: `(preSum - k)`
6838
+
-4. Use the calculated preSum candidate to find index
6839
+
-5. Use found index to calculate for result. ex: calculate range.
6840
+
6841
+
6842
+
6843
+
---
6844
+
6845
+
**226. [Kth Largest Element in an Array.java](https://github.com/awangdev/LintCode/blob/master/Java/Kth%20Largest%20Element%20in%20an%20Array.java)** Level: Medium Tags: [Divide and Conquer, Heap]
6846
+
6847
+
6848
+
6849
+
6850
+
---
6851
+
6852
+
**227. [Contiguous Array.java](https://github.com/awangdev/LintCode/blob/master/Java/Contiguous%20Array.java)** Level: Medium Tags: [Hash Table]
Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -471,3 +471,7 @@
471
471
|450|[Accounts Merge.java](https://github.com/awangdev/LintCode/blob/master/Java/Accounts%20Merge.java)|Medium|Java|[DFS, Hash Table, Union Find]||
472
472
|451|[Exclusive Time of Functions.java](https://github.com/awangdev/LintCode/blob/master/Java/Exclusive%20Time%20of%20Functions.java)|Medium|Java|[Stack]||
473
473
|452|[Friends Of Appropriate Ages.java](https://github.com/awangdev/LintCode/blob/master/Java/Friends%20Of%20Appropriate%20Ages.java)|Medium|Java|[Array, Math]||
|454|[Maximum Size Subarray Sum Equals k.java](https://github.com/awangdev/LintCode/blob/master/Java/Maximum%20Size%20Subarray%20Sum%20Equals%20k.java)|Medium|Java|[Hash Table, PreSum]||
476
+
|455|[Kth Largest Element in an Array.java](https://github.com/awangdev/LintCode/blob/master/Java/Kth%20Largest%20Element%20in%20an%20Array.java)|Medium|Java|[Divide and Conquer, Heap]||
Copy file name to clipboardExpand all lines: ReviewPage.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8776,5 +8776,47 @@ space: O(X), X = max wall width
8776
8776
8777
8777
8778
8778
8779
+
---
8780
+
8781
+
**453. [Target Sum.java](https://github.com/awangdev/LintCode/blob/master/Java/Target%20Sum.java)** Level: Medium Tags: [DFS, DP]
8782
+
8783
+
8784
+
// 如何想到从中间initialize
8785
+
8786
+
8787
+
8788
+
---
8789
+
8790
+
**454. [Maximum Size Subarray Sum Equals k.java](https://github.com/awangdev/LintCode/blob/master/Java/Maximum%20Size%20Subarray%20Sum%20Equals%20k.java)** Level: Medium Tags: [Hash Table, PreSum]
8791
+
8792
+
time: O(n)
8793
+
space: O(n)
8794
+
8795
+
#### Map<preSumValue, index>
8796
+
- use `Map<preSum value, index>` to store inline preSum and its index.
8797
+
-1. Build presum incline
8798
+
-2. Use map to cache current preSum value and its index: `Map<preSum value, index>`
8799
+
-3. Each iteration: calculate possible preSum candidate that prior target sequence. ex: `(preSum - k)`
8800
+
-4. Use the calculated preSum candidate to find index
8801
+
-5. Use found index to calculate for result. ex: calculate range.
8802
+
8803
+
8804
+
8805
+
---
8806
+
8807
+
**455. [Kth Largest Element in an Array.java](https://github.com/awangdev/LintCode/blob/master/Java/Kth%20Largest%20Element%20in%20an%20Array.java)** Level: Medium Tags: [Divide and Conquer, Heap]
8808
+
8809
+
8810
+
8811
+
8812
+
---
8813
+
8814
+
**456. [Contiguous Array.java](https://github.com/awangdev/LintCode/blob/master/Java/Contiguous%20Array.java)** Level: Medium Tags: [Hash Table]
0 commit comments