Skip to content

Commit 9a9cc6e

Browse files
committed
20190306
1 parent 0e078c5 commit 9a9cc6e

File tree

9 files changed

+275
-86
lines changed

9 files changed

+275
-86
lines changed

Top100.md

-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
<img src="img/readme.png"></a>
2-
3-
The user's favorite 100 problems are very classic. If you are a newbie, this is the best way to get started with leetcode.
4-
5-
---
6-
7-
用户最喜欢的100道题都是很经典的问题,是新手入门 leetcode 的最好方式。
8-
91
### Top 100 Liked Questions
102

113
| \# | Problems | Difficulty | Solution |

TopInterview.md

+80-68
Original file line numberDiff line numberDiff line change
@@ -8,131 +8,143 @@
88
| 003 | [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | Medium | [Java](./code/lc3.java)
99
| 004 | [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays) | Hard | [Java](./code/lc4.java)
1010
| 005 | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) |Medium|[Java](./code/lc5.java)
11-
11+
| 007 | [Reverse Integer](https://leetcode.com/problems/reverse-integer/) |Easy|[Java](./code/lc7.java)
12+
| 008 | [String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi/) |Medium|[Java](./code/lc8.java)
1213
| 010 | [Regular Expression Matching](https://leetcode.com/problems/regular-expression-matching/) | Hard | [Java](./code/lc10.java)
1314
| 011 | [Container With Most Water](https://leetcode.com/problems/container-with-most-water/) |Medium| [Java](./code/lc11.java)
14-
15-
16-
| 015 | [3Sum](https://leetcode.com/problems/3sum/) |Medium| [Java](./code/lc15.java)
17-
| 017 | [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/) |Medium| [Java](./code/lc17.java)
15+
| 013 | [Roman to Integer](https://leetcode.com/problems/roman-to-integer) |Easy| [Java](./code/lc13.java)
16+
| 014 | [Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix) |Easy| [Java](./code/lc14.java)
17+
| 015 | [3Sum](https://leetcode.com/problems/3sum/) | Medium | [Java](./code/lc15.java)
18+
| 017 | [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/) | Medium | [Java](./code/lc17.java)
1819
| 019 | [Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/) | Easy | [Java](./code/lc19.java)
1920
| 020 | [Valid Parentheses](https://leetcode.com/problems/valid-parentheses/) | Easy | [Java](./code/lc20.java)
2021
| 021 | [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/) | Easy | [Java](./code/lc21.java)
2122
| 022 | [Generate Parentheses](https://leetcode.com/problems/generate-parentheses/) |Medium| [Java](./code/lc22.java)
2223
| 023 | [Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) | Hard | [Java](./code/lc23.java)
23-
| 029 |
24-
24+
| 026 | [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array) | Easy | [Java](./code/lc26.java)
25+
| 028 | [Implement strStr()](https://leetcode.com/problems/implement-strstr) | Easy | [Java](./code/lc28.java)
26+
| 029 | [Divide Two Integers](https://leetcode.com/problems/divide-two-integers) | Medium | [Java](./code/lc29.java)
2527
| 033 | [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/) |Medium| [Java](./code/lc33.java)
2628
| 034 | [Search for a Range](https://leetcode.com/problems/search-for-a-range/) |Medium| [Java](./code/lc34.java)
2729
| 035 | [Search Insert Position](https://leetcode.com/problems/search-insert-position/) |Medium| [Java](./code/lc35.java)
28-
| 036 |
29-
| 041 |
30-
31-
30+
| 036 | [Valid Sudoku]() | Medium | [Java](./code/lc36.java)
31+
| 038 | [Count and Say]() | Easy | [Java](./code/lc38.java)
32+
| 041 | [First Missing Positive]() | Hard | [Java](./code/lc41.java)
3233
| 042 | [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) | Hard | [Java](./code/lc42.java)
33-
| 044 |
34-
34+
| 044 | [Wildcard Matching]() | Hard | [Java](./code/lc44.java)
3535
| 046 | [Permutations](https://leetcode.com/problems/permutations/) |Medium| [Java](./code/lc46.java)
3636
| 048 | [Rotate Image](https://leetcode.com/problems/rotate-image/) |Medium| [Java](./code/lc48.java)
3737
| 049 | [Group Anagrams](https://leetcode.com/problems/anagrams/)|Medium| [Java](./code/lc49.java)
38-
| 050 |
39-
38+
| 050 | [Pow(x, n)]() | Medium | [Java](./code/lc50.java)
4039
| 053 | [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/) |Medium| [Java](./code/lc53.java)
41-
| 054 |
40+
| 054 | [Spiral Matrix]() | Medium | [Java](./code/lc54.java)
4241
| 055 | [Jump Game](https://leetcode.com/problems/jump-game/) |Medium| [Java](./code/lc55.java)
4342
| 056 | [Merge Intervals](https://leetcode.com/problems/merge-intervals/) |Medium| [Java](./code/lc56.java)
4443
| 062 | [Unique Paths](https://leetcode.com/problems/unique-paths/) |Medium| [Java](./code/lc62.java)
45-
46-
44+
| 066 | [Plus One]() | Easy | [Java](./code/lc66.java)
45+
| 069 | [Sqrt(x)]() | Easy | [Java](./code/lc69.java)
4746
| 070 | [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/) | Easy | [Java](./code/lc70.java)
48-
49-
| 073 |
50-
47+
| 073 | [Set Matrix Zeroes]() | Medium | [Java](./code/lc73.java)
5148
| 075 | [Sort Colors](https://leetcode.com/problems/sort-colors/)|Medium| [Java](./code/lc75.java)
5249
| 076 | [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring) | Hard| [Java](./code/lc76.java)
5350
| 078 | [Subsets](https://leetcode.com/problems/subsets/) |Medium| [Java](./code/lc78.java)
5451
| 079 | [Word Search](https://leetcode.com/problems/word-search/)|Medium| [Java](./code/lc79.java)
5552
| 084 | [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram) | Hard | [Java](./code/lc84.java)
56-
57-
53+
| 088 | [Merge Sorted Array]() | Easy | [Java](./code/lc88.java)
54+
| 091 | [Decode Ways]() | Medium | [Java](./code/lc91.java)
5855
| 094 | [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/) |Medium| [Java](./code/lc94.java)
59-
6056
| 098 | [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/) |Medium| [Java](./code/lc98.java)
6157
| 101 | [Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | Easy | [Java](./code/lc101.java)
6258
| 102 | [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/) | Easy | [Java](./code/lc102.java)
63-
59+
| 103 | [Binary Tree Zigzag Level Order Traversal]() | Medium | [Java](./code/lc103.java)
6460
| 104 | [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/) | Easy | [Java](./code/lc104.java)
6561
| 105 | [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) |Medium| [Java](./code/lc105.java)
66-
67-
68-
69-
62+
| 108 | [Convert Sorted Array to Binary Search Tree]() | Easy | [Java](./code/lc108.java)
63+
| 116 | [Populating Next Right Pointers in Each Node ]() | Medium | [Java](./code/lc116.java)
64+
| 118 | [Pascal's Triangle]() | Easy | [Java](./code/lc118.java)
7065
| 121 | [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | Easy | [Java](./code/lc121.java)
71-
66+
| 122 | [Best Time to Buy and Sell Stock II]() | Easy | [Java](./code/lc122].java)
7267
| 124 | [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/) | Hard | [Java](./code/lc124.java)
73-
74-
68+
| 125 | [Valid Palindrome]() | Easy | [Java](./code/lc125.java)
69+
| 127 | [Word Ladder]() | Medium | [Java](./code/lc127.java)
7570
| 128 | [Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/) | Hard | [Java](./code/lc128.java)
76-
77-
78-
71+
| 130 | [Surrounded Regions]() | Medium | [Java](./code/lc130.java)
72+
| 131 | [Palindrome Partitioning]() | Medium | [Java](./code/lc131.java)
73+
| 134 | [Gas Station]() | Medium | [Java](./code/lc134.java)
7974
| 136 | [Single Number](https://leetcode.com/problems/single-number) | Easy | [Java](./code/lc136.java)
80-
75+
| 138 | [Copy List with Random Pointer]() | Medium | [Java](./code/lc138.java)
8176
| 139 | [Word Break](https://leetcode.com/problems/word-break/) |Medium| [Java](./code/lc139.java)
82-
77+
| 140 | [Word Break II]() | Hard | [Java](./code/lc140.java)
8378
| 141 | [Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/) | Easy | [Java](./code/lc141.java)
84-
8579
| 146 | [LRU Cache](https://leetcode.com/problems/lru-cache/) | Hard | [Java](./code/lc146.java)
8680
| 148 | [Sort List](https://leetcode.com/problems/sort-list/) |Medium| [Java](./code/lc148.java)
87-
88-
89-
81+
| 149 | [Max Points on a Line]() | Hard | [Java](./code/lc149.java)
82+
| 150 | [Evaluate Reverse Polish Notation]() | Medium | [Java](./code/lc150.java)
9083
| 152 | [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/) |Medium| [Java](./code/lc152.java)
9184
| 155 | [Min Stack](https://leetcode.com/problems/min-stack/) | Easy | [Java](./code/lc155.java)
9285
| 160 | [Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists/) | Easy | [Java](./code/lc160.java)
93-
94-
95-
96-
86+
| 162 | [Find Peak Element]() | Medium | [Java](./code/lc162.java)
87+
| 163 | [Missing Ranges](https://leetcode.com/problems/missing-ranges) | Medium | [没权限]
88+
| 166 | [Fraction to Recurring Decimal]() | Medium | [Java](./code/lc166.java)
9789
| 169 | [Majority Element](https://leetcode.com/problems/majority-element/) | Easy | [Java](./code/lc169.java)
90+
| 171 | [Excel Sheet Column Number]() | Easy | [Java](./code/lc171.java)
91+
| 172 | [Factorial Trailing Zeroes]() | Easy | [Java](./code/lc172.java)
92+
| 179 | [Largest Number]() | Medium | [Java](./code/lc179.java)
93+
| 189 | [Rotate Array]() | Easy | [Java](./code/lc189.java)
94+
| 190 | [Reverse Bits]() | Easy | [Java](./code/lc190.java)
95+
| 191 | [Number of 1 Bits]() | Easy | [Java](./code/lc191.java)
9896
| 198 | [House Robber](https://leetcode.com/problems/house-robber/) | Easy | [Java](./code/lc198.java)
9997
| 200 | [Number of Islands](https://leetcode.com/problems/number-of-islands/) |Medium| [Java](./code/lc200.java)
100-
101-
98+
| 202 | [Happy Number]() | Easy | [Java](./code/lc202.java)
99+
| 204 | [Count Primes]() | Easy | [Java](./code/lc204.java)
102100
| 206 | [Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/) | Easy |[Java](./code/lc206.java)
103101
| 207 | [Course Schedule](https://leetcode.com/problems/course-schedule/) |Medium|[Java](./code/lc207.java)
104102
| 208 | [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/) |Medium| [Java](./code/lc208.java)
105-
106-
107-
103+
| 210 | [Course Schedule II]() | Medium | [Java](./code/lc210.java)
104+
| 212 | [Word Search II]() | Hard | [Java](./code/lc212.java)
108105
| 215 | [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) |Medium| [Java](./code/lc215.java)
109-
110-
111-
106+
| 217 | [Contains Duplicate]() | Easy | [Java](./code/lc217.java)
107+
| 218 | [The Skyline Problem]() | Hard | [Java](./code/lc218.java)
108+
| 227 | [Basic Calculator II]() | Medium | [Java](./code/lc227.java)
109+
| 230 | [Kth Smallest Element in a BST]() | Medium | [Java](./code/lc230.java)
112110
| 234 | [Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/) | Easy | [Java](./code/lc234.java)
113111
| 236 | [Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/) |Medium| [Java](./code/lc236.java)
114-
112+
| 237 | [Delete Node in a Linked List]() | | [Java](./code/lc237.java)
115113
| 238 | [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) |Medium| [Java](./code/lc238.java)
116114
| 239 | [Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum/) | Hard | [Java](./code/lc239.java)
117115
| 240 | [Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/) |Medium| [Java](./code/lc240.java)
118-
119-
116+
| 242 | [Valid Anagram]() | | [Java](./code/lc242.java)
117+
| 251 | [Flatten 2D Vector](https://leetcode.com/problems/flatten-2d-vector) | Medium | [没权限]
118+
| 253 | [Meeting Rooms II](https://leetcode.com/problems/meeting-rooms-ii) | Medium | [没权限]
119+
| 268 | [Missing Number]() | | [Java](./code/lc268.java)
120+
| 269 | [Alien Dictionary]() | Hard |[没权限]
121+
| 277 | [Find the Celebrity]() | Medium | [没权限]
120122
| 279 | [Perfect Squares](https://leetcode.com/problems/perfect-squares/) |Medium| [Java](./code/lc279.java)
121123
| 283 | [Move Zeroes](https://leetcode.com/problems/move-zeroes/)| Easy | [Java](./code/lc283.java)
122-
124+
| 285 | [Inorder Successor in BST](https://leetcode.com/problems/inorder-successor-in-bst) | Medium | [没权限]
123125
| 287 | [Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/) | Hard | [Java](./code/lc287.java)
124-
125-
126+
| 295 | [Find Median from Data Stream]() | Hard | [Java](./code/lc295.java)
126127
| 297 | [Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/) | Hard | [Java](./code/lc297.java)
127128
| 300 | [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) |Medium| [Java](./code/lc300.java)
128-
129-
129+
| 308 | [Range Sum Query 2D - Mutable](https://leetcode.com/problems/range-sum-query-2d-mutable) | Medium | [没权限]
130+
| 315 | [Count of Smaller Numbers After Self]() | Hard | [Java](./code/lc315.java)
130131
| 322 | [Coin Change](https://leetcode.com/problems/coin-change/)|Medium| [Java](./code/lc322.java)
131-
132-
133-
134-
135-
136-
137-
| 337 | [House Robber III](https://leetcode.com/problems/house-robber-iii/) |Medium| [Java](./code/lc337.java)
132+
| 324 | [Wiggle Sort II]() | Medium | [Java](./code/lc324.java)
133+
| 326 | [Power of Three]() | Easy | [Java](./code/lc326.java)
134+
| 328 | [Odd Even Linked List]() | Medium | [Java](./code/lc328.java)
135+
| 329 | [Longest Increasing Path in a Matrix]() | Hard | [Java](./code/lc329.java)
136+
| 334 | [Increasing Triplet Subsequence]() | Medium | [Java](./code/lc334.java)
137+
| 340 | [Longest Substring with At Most K Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters) | Hard | [Java](./code/lc340.java)
138+
| 341 | [Flatten Nested List Iterator]() | Medium | [Java](./code/lc341.java)
139+
| 344 | [Reverse String]() | Easy | [Java](./code/lc344.java)
138140
| 347 | [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) |Medium| [Java](./code/lc347.java)
141+
| 348 | [Design Tic-Tac-Toe](https://leetcode.com/problems/design-tic-tac-toe) | Medium | [没权限]
142+
| 350 | [Intersection of Two Arrays II]() | Easy | [Java](./code/lc350.java)
143+
| 371 | [Sum of Two Integers]() | Easy | [Java](./code/lc371.java)
144+
| 378 | [Kth Smallest Element in a Sorted Matrix]() | Medium | [Java](./code/lc378.java)
145+
| 380 | [Insert Delete GetRandom O(1)]() | Medium | [Java](./code/lc380.java)
146+
| 384 | [Shuffle an Array]() | Medium | [Java](./code/lc384.java)
147+
| 387 | [First Unique Character in a String]() | Easy | [Java](./code/lc387.java)
148+
| 395 | [Longest Substring with At Least K Repeating Characters]() | Medium | [Java](./code/lc395.java)
149+
| 412 | [Fizz Buzz](https://leetcode.com/problems/fizz-buzz) | Easy | [Java](./code/lc412.java)
150+
| 454 | [4Sum II](https://leetcode.com/problems/4sum-ii) | Medium | [Java](./code/lc454.java)

code/lc350.java

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package code;
2+
/*
3+
* 350. Intersection of Two Arrays II
4+
* 题意:求两个数组的交集
5+
* 难度:Easy
6+
* 分类:Hash Table, Two Pointers, Binary Search, Sort
7+
* 思路:HashMap, 注意重复的数字,用计数进行处理
8+
* Tips:如果两个数组足够大,那么如何处理?
9+
* 如果其中一个可以加载到内存中,则HashMap处理以后,流式读取第二个数组
10+
* 如果都不能加载,则先外部排序,再用类似归并链表的方式读取数据
11+
*/
12+
import java.util.ArrayList;
13+
import java.util.HashMap;
14+
15+
public class lc350 {
16+
public int[] intersect(int[] nums1, int[] nums2) {
17+
ArrayList<Integer> res = new ArrayList();
18+
HashMap<Integer, Integer> hm = new HashMap();
19+
for (int i : nums1) hm.put(i, hm.getOrDefault(i, 0) + 1);
20+
for (int i : nums2) {
21+
if (hm.getOrDefault(i, 0) > 0) {
22+
res.add(i);
23+
hm.put(i, hm.get(i) - 1);
24+
}
25+
}
26+
int[] res_arr = new int[res.size()]; //toArray方法只能转化为 Integer[] 类型,和返回值不一致
27+
for (int i = 0; i < res_arr.length; i++) {
28+
res_arr[i] = res.get(i);
29+
}
30+
return res_arr;
31+
}
32+
}

code/lc371.java

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package code;
2+
/*
3+
* 371. Sum of Two Integers
4+
* 题意:两个数相加,但不能用 + - 操作符号
5+
* 难度:Easy
6+
* 分类:Bit Maniputation
7+
* 思路:自己没想起来
8+
* https://leetcode.com/problems/sum-of-two-integers/discuss/84278/A-summary%3A-how-to-use-bit-manipulation-to-solve-problems-easily-and-efficiently
9+
* Tips:
10+
*/
11+
public class lc371 {
12+
public int getSum(int a, int b) {
13+
return b==0? a:getSum(a^b, (a&b)<<1); // a^b 为不算进位的结果,加上进位
14+
}
15+
}

code/lc387.java

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package code;
2+
/*
3+
* 387. First Unique Character in a String
4+
* 题意:第一个没有重复的字符索引
5+
* 难度:Easy
6+
* 分类:Hash Table, String
7+
* 思路:
8+
* Tips:
9+
*/
10+
public class lc387 {
11+
public int firstUniqChar(String s) {
12+
int freq [] = new int[26];
13+
for(int i = 0; i < s.length(); i ++)
14+
freq [s.charAt(i) - 'a'] ++;
15+
for(int i = 0; i < s.length(); i ++)
16+
if(freq [s.charAt(i) - 'a'] == 1)
17+
return i;
18+
return -1;
19+
}
20+
}

code/lc395.java

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package code;
2+
/*
3+
* 395. Longest Substring with At Least K Repeating Characters
4+
* 题意:求最长子串,子串中每个字符都必须最少出现K次
5+
* 难度:Medium
6+
* 分类:
7+
* 思路:两种,一种是 Two Pointers 模板找子串,不过外层加了个循环,表示子串中有几个不同的字符
8+
* 递归,每次统计字符出现了几次,不足K的作为分割点
9+
* Tips:lc76模板
10+
* 想到了利用不足K的分割点作为切点,挺难的
11+
*/
12+
public class lc395 {
13+
public int longestSubstring(String s, int k) {
14+
int res = 0;
15+
for (int i = 1; i <= 26 ; i++) {
16+
int left = 0, right = 0, cur_uni_char = 0, less_than_k_char = 0;
17+
int[] map = new int[26];
18+
while(right<s.length()){ //右边推进
19+
map[s.charAt(right)-'a']++;
20+
if(map[s.charAt(right)-'a']==k) less_than_k_char++;
21+
if(map[s.charAt(right)-'a']==1) cur_uni_char++;
22+
right++;
23+
24+
if( cur_uni_char==i && less_than_k_char==i) res = Math.max(res, right-left);
25+
26+
else if(cur_uni_char>i){ //左边推进
27+
while(cur_uni_char!=i){
28+
map[s.charAt(left)-'a']--;
29+
if(map[s.charAt(left)-'a']==0) cur_uni_char--;
30+
if((map[s.charAt(left)-'a']==k-1)) less_than_k_char--;
31+
left++;
32+
}
33+
}
34+
}
35+
}
36+
return res;
37+
}
38+
39+
public int longestSubstring2(String s, int k) {
40+
return helper(s, k, 0, s.length()-1);
41+
}
42+
public int helper(String s, int k, int left, int right){
43+
int[] map = new int[26];
44+
for (int i = left; i <= right ; i++) map[s.charAt(i)-'a']++;
45+
for (int i = left; i <= right ; i++) { //遍历所有的分割点
46+
if(map[s.charAt(i)-'a']<k){
47+
int left_max = helper(s, k, left, i-1);
48+
int right_max = helper(s, k, i+1, right);
49+
return Math.max(left_max, right_max); //直接返回了,就不遍历后续了,因为子情况会去计算后续的分割点
50+
}
51+
}
52+
return right-left+1;
53+
}
54+
}

0 commit comments

Comments
 (0)