Skip to content

Commit 040a7cf

Browse files
committed
Update: Hints
1 parent f0ab086 commit 040a7cf

File tree

33 files changed

+320
-47
lines changed

33 files changed

+320
-47
lines changed

problems/house-robber-ii/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/word-search-ii "Word Search II")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/shortest-palindrome "Shortest Palindrome")
11+
812
## 213. House Robber II (Medium)
913

1014
<p>You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are <strong>arranged in a circle.</strong> That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have security system connected and&nbsp;<b>it will automatically contact the police if two adjacent houses were broken into on the same night</b>.</p>
@@ -40,4 +44,7 @@
4044
1. [Coin Path](https://github.com/openset/leetcode/tree/master/problems/coin-path) (Hard)
4145

4246
### Hints
43-
1. Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the <a href ="https://leetcode.com/problems/house-robber/description/">House Robber</a>, which is already been solved.
47+
<details>
48+
<summary>Hint 1</summary>
49+
Since House[1] and House[n] are adjacent, they cannot be robbed together. Therefore, the problem becomes to rob either House[1]-House[n-1] or House[2]-House[n], depending on which choice offers more money. Now the problem has degenerated to the <a href ="https://leetcode.com/problems/house-robber/description/">House Robber</a>, which is already been solved.
50+
</details>

problems/investments-in-2016/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/find-customer-referee "Find Customer Referee")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/customer-placing-the-largest-number-of-orders "Customer Placing the Largest Number of Orders")
11+
812
## 585. Investments in 2016 (Medium)
913

1014
<p>Write a query to print the sum of all total investment values in 2016 (<b>TIV_2016</b>), to a scale of 2 decimal places, for all policy holders who meet the following criteria:</p>
@@ -60,4 +64,7 @@ And its location is the same with the third record, which makes the third record
6064
So, the result is the sum of <b>TIV_2016</b> of the first and last record, which is 45.</pre>
6165

6266
### Hints
63-
1. Make the (LAT, LON) a pair to represent the location information
67+
<details>
68+
<summary>Hint 1</summary>
69+
Make the (LAT, LON) a pair to represent the location information
70+
</details>

problems/max-chunks-to-make-sorted-ii/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/reorganize-string "Reorganize String")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/max-chunks-to-make-sorted "Max Chunks To Make Sorted")
11+
812
## 768. Max Chunks To Make Sorted II (Hard)
913

1014
<p><em>This question is the same as &quot;Max Chunks to Make Sorted&quot; except the integers of the given array are not necessarily distinct, the input array could be up to length <code>2000</code>, and the elements could be up to <code>10**8</code>.</em></p>
@@ -51,4 +55,7 @@ However, splitting into [2, 1], [3], [4], [4] is the highest number of chunks po
5155
1. [Max Chunks To Make Sorted](https://github.com/openset/leetcode/tree/master/problems/max-chunks-to-make-sorted) (Medium)
5256

5357
### Hints
54-
1. Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk.
58+
<details>
59+
<summary>Hint 1</summary>
60+
Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk.
61+
</details>

problems/max-chunks-to-make-sorted/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/max-chunks-to-make-sorted-ii "Max Chunks To Make Sorted II")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/basic-calculator-iv "Basic Calculator IV")
11+
812
## 769. Max Chunks To Make Sorted (Medium)
913

1014
<p>Given an array <code>arr</code> that is a permutation of <code>[0, 1, ..., arr.length - 1]</code>, we split the array into some number of &quot;chunks&quot; (partitions), and individually sort each chunk.&nbsp; After concatenating them,&nbsp;the result equals the sorted array.</p>
@@ -47,4 +51,7 @@ However, splitting into [1, 0], [2], [3], [4] is the highest number of chunks po
4751
1. [Max Chunks To Make Sorted II](https://github.com/openset/leetcode/tree/master/problems/max-chunks-to-make-sorted-ii) (Hard)
4852

4953
### Hints
50-
1. The first chunk can be found as the smallest k for which A[:k+1] == [0, 1, 2, ...k]; then we repeat this process.
54+
<details>
55+
<summary>Hint 1</summary>
56+
The first chunk can be found as the smallest k for which A[:k+1] == [0, 1, 2, ...k]; then we repeat this process.
57+
</details>

problems/min-cost-climbing-stairs/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/prefix-and-suffix-search "Prefix and Suffix Search")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/largest-number-at-least-twice-of-others "Largest Number At Least Twice of Others")
11+
812
## 746. Min Cost Climbing Stairs (Easy)
913

1014
<p>
@@ -44,4 +48,7 @@ Once you pay the cost, you can either climb one or two steps. You need to find m
4448
1. [Climbing Stairs](https://github.com/openset/leetcode/tree/master/problems/climbing-stairs) (Easy)
4549

4650
### Hints
47-
1. Say f[i] is the final cost to climb to the top from step i. Then f[i] = cost[i] + min(f[i+1], f[i+2]).
51+
<details>
52+
<summary>Hint 1</summary>
53+
Say f[i] is the final cost to climb to the top from step i. Then f[i] = cost[i] + min(f[i+1], f[i+2]).
54+
</details>

problems/minimum-ascii-delete-sum-for-two-strings/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/number-of-distinct-islands-ii "Number of Distinct Islands II")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/subarray-product-less-than-k "Subarray Product Less Than K")
11+
812
## 712. Minimum ASCII Delete Sum for Two Strings (Medium)
913

1014
<p>Given two strings <code>s1, s2</code>, find the lowest ASCII sum of deleted characters to make two strings equal.</p>
@@ -44,4 +48,7 @@ If instead we turned both strings into "lee" or "eet", we would get answers of 4
4448
1. [Delete Operation for Two Strings](https://github.com/openset/leetcode/tree/master/problems/delete-operation-for-two-strings) (Medium)
4549

4650
### Hints
47-
1. Let dp(i, j) be the answer for inputs s1[i:] and s2[j:].
51+
<details>
52+
<summary>Hint 1</summary>
53+
Let dp(i, j) be the answer for inputs s1[i:] and s2[j:].
54+
</details>

problems/monotone-increasing-digits/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/sentence-similarity-ii "Sentence Similarity II")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/daily-temperatures "Daily Temperatures")
11+
812
## 738. Monotone Increasing Digits (Medium)
913

1014
<p>
@@ -45,4 +49,7 @@ Given a non-negative integer <code>N</code>, find the largest number that is les
4549
1. [Remove K Digits](https://github.com/openset/leetcode/tree/master/problems/remove-k-digits) (Medium)
4650

4751
### Hints
48-
1. Build the answer digit by digit, adding the largest possible one that would make the number still less than or equal to N.
52+
<details>
53+
<summary>Hint 1</summary>
54+
Build the answer digit by digit, adding the largest possible one that would make the number still less than or equal to N.
55+
</details>

problems/my-calendar-i/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/self-dividing-numbers "Self Dividing Numbers")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/count-different-palindromic-subsequences "Count Different Palindromic Subsequences")
11+
812
## 729. My Calendar I (Medium)
913

1014
<p>
@@ -46,4 +50,7 @@ The third event can be booked, as the first event takes every time less than 20,
4650
1. [My Calendar III](https://github.com/openset/leetcode/tree/master/problems/my-calendar-iii) (Hard)
4751

4852
### Hints
49-
1. Store the events as a sorted list of intervals. If none of the events conflict, then the new event can be added.
53+
<details>
54+
<summary>Hint 1</summary>
55+
Store the events as a sorted list of intervals. If none of the events conflict, then the new event can be added.
56+
</details>

problems/my-calendar-ii/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/count-different-palindromic-subsequences "Count Different Palindromic Subsequences")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/my-calendar-iii "My Calendar III")
11+
812
## 731. My Calendar II (Medium)
913

1014
<p>
@@ -53,4 +57,7 @@ the time [40, 50) will be single booked, and the time [50, 55) will be double bo
5357
1. [My Calendar III](https://github.com/openset/leetcode/tree/master/problems/my-calendar-iii) (Hard)
5458

5559
### Hints
56-
1. Store two sorted lists of intervals: one list will be all times that are at least single booked, and another list will be all times that are definitely double booked. If none of the double bookings conflict, then the booking will succeed, and you should update your single and double bookings accordingly.
60+
<details>
61+
<summary>Hint 1</summary>
62+
Store two sorted lists of intervals: one list will be all times that are at least single booked, and another list will be all times that are definitely double booked. If none of the double bookings conflict, then the booking will succeed, and you should update your single and double bookings accordingly.
63+
</details>

problems/my-calendar-iii/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<!--|@home https://github.com/openset/leetcode |-->
66
<!--+----------------------------------------------------------------------+-->
77

8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/my-calendar-ii "My Calendar II")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/flood-fill "Flood Fill")
11+
812
## 732. My Calendar III (Hard)
913

1014
<p>Implement a <code>MyCalendarThree</code> class to store your events. A new event can <b>always</b> be added.</p>
@@ -54,4 +58,7 @@ eg. [10, 20), [10, 40), and [5, 15) are still triple booked.
5458
1. [My Calendar II](https://github.com/openset/leetcode/tree/master/problems/my-calendar-ii) (Medium)
5559

5660
### Hints
57-
1. Treat each interval [start, end) as two events "start" and "end", and process them in sorted order.
61+
<details>
62+
<summary>Hint 1</summary>
63+
Treat each interval [start, end) as two events "start" and "end", and process them in sorted order.
64+
</details>

0 commit comments

Comments
 (0)