diff --git a/README.md b/README.md index e94478faf..964f7997c 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,18 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | -| 1225 | [Report Contiguous Dates](https://leetcode.com/problems/report-contiguous-dates) | [MySQL](https://github.com/openset/leetcode/tree/master/problems/report-contiguous-dates) | Hard | +| 1236 | [Web Crawler](https://leetcode.com/problems/web-crawler) šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/web-crawler) | Medium | +| 1235 | [Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling "č§„åˆ’å…¼čŒå·„ä½œ") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-profit-in-job-scheduling) | Hard | +| 1234 | [Replace the Substring for Balanced String](https://leetcode.com/problems/replace-the-substring-for-balanced-string "ę›æę¢å­äø²å¾—åˆ°å¹³č””å­—ē¬¦äø²") | [Go](https://github.com/openset/leetcode/tree/master/problems/replace-the-substring-for-balanced-string) | Medium | +| 1233 | [Remove Sub-Folders from the Filesystem](https://leetcode.com/problems/remove-sub-folders-from-the-filesystem "åˆ é™¤å­ę–‡ä»¶å¤¹") | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-sub-folders-from-the-filesystem) | Medium | +| 1232 | [Check If It Is a Straight Line](https://leetcode.com/problems/check-if-it-is-a-straight-line "ē¼€ē‚¹ęˆēŗæ") | [Go](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-straight-line) | Easy | +| 1231 | [Divide Chocolate](https://leetcode.com/problems/divide-chocolate "åˆ†äŗ«å·§å…‹åŠ›") šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/divide-chocolate) | Hard | +| 1230 | [Toss Strange Coins](https://leetcode.com/problems/toss-strange-coins "ęŠ›ęŽ·ē”¬åø") šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/toss-strange-coins) | Medium | +| 1229 | [Meeting Scheduler](https://leetcode.com/problems/meeting-scheduler "å®‰ęŽ’ä¼šč®®ę—„ēØ‹") šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/meeting-scheduler) | Medium | +| 1228 | [Missing Number In Arithmetic Progression](https://leetcode.com/problems/missing-number-in-arithmetic-progression "ē­‰å·®ę•°åˆ—äø­ē¼ŗå¤±ēš„ę•°å­—") šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/missing-number-in-arithmetic-progression) | Easy | +| 1227 | [Airplane Seat Assignment Probability](https://leetcode.com/problems/airplane-seat-assignment-probability) | [Go](https://github.com/openset/leetcode/tree/master/problems/airplane-seat-assignment-probability) | Medium | +| 1226 | [The Dining Philosophers](https://leetcode.com/problems/the-dining-philosophers) | [Go](https://github.com/openset/leetcode/tree/master/problems/the-dining-philosophers) | Medium | +| 1225 | [Report Contiguous Dates](https://leetcode.com/problems/report-contiguous-dates) šŸ”’ | [MySQL](https://github.com/openset/leetcode/tree/master/problems/report-contiguous-dates) | Hard | | 1224 | [Maximum Equal Frequency](https://leetcode.com/problems/maximum-equal-frequency "ęœ€å¤§ē›øē­‰é¢‘ēŽ‡") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-equal-frequency) | Hard | | 1223 | [Dice Roll Simulation](https://leetcode.com/problems/dice-roll-simulation "ęŽ·éŖ°å­ęØ”ę‹Ÿ") | [Go](https://github.com/openset/leetcode/tree/master/problems/dice-roll-simulation) | Medium | | 1222 | [Queens That Can Attack the King](https://leetcode.com/problems/queens-that-can-attack-the-king "åÆä»„ę”»å‡»å›½ēŽ‹ēš„ēš‡åŽ") | [Go](https://github.com/openset/leetcode/tree/master/problems/queens-that-can-attack-the-king) | Medium | @@ -99,7 +110,7 @@ LeetCode Problems' Solutions | 1191 | [K-Concatenation Maximum Sum](https://leetcode.com/problems/k-concatenation-maximum-sum "K ę¬”äø²č”åŽęœ€å¤§å­ę•°ē»„ä¹‹å’Œ") | [Go](https://github.com/openset/leetcode/tree/master/problems/k-concatenation-maximum-sum) | Medium | | 1190 | [Reverse Substrings Between Each Pair of Parentheses](https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses "åč½¬ęÆåÆ¹ę‹¬å·é—“ēš„å­äø²") | [Go](https://github.com/openset/leetcode/tree/master/problems/reverse-substrings-between-each-pair-of-parentheses) | Medium | | 1189 | [Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons "ā€œę°”ēƒā€ ēš„ęœ€å¤§ę•°é‡") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-number-of-balloons) | Easy | -| 1188 | [Design Bounded Blocking Queue](https://leetcode.com/problems/design-bounded-blocking-queue) šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/design-bounded-blocking-queue) | Medium | +| 1188 | [Design Bounded Blocking Queue](https://leetcode.com/problems/design-bounded-blocking-queue "č®¾č®”ęœ‰é™é˜»å”žé˜Ÿåˆ—") šŸ”’ | [Go](https://github.com/openset/leetcode/tree/master/problems/design-bounded-blocking-queue) | Medium | | 1187 | [Make Array Strictly Increasing](https://leetcode.com/problems/make-array-strictly-increasing "ä½æę•°ē»„äø„ę ¼é€’å¢ž") | [Go](https://github.com/openset/leetcode/tree/master/problems/make-array-strictly-increasing) | Hard | | 1186 | [Maximum Subarray Sum with One Deletion](https://leetcode.com/problems/maximum-subarray-sum-with-one-deletion "åˆ é™¤äø€ę¬”å¾—åˆ°å­ę•°ē»„ęœ€å¤§å’Œ") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-subarray-sum-with-one-deletion) | Medium | | 1185 | [Day of the Week](https://leetcode.com/problems/day-of-the-week "äø€å‘Øäø­ēš„ē¬¬å‡ å¤©") | [Go](https://github.com/openset/leetcode/tree/master/problems/day-of-the-week) | Easy | @@ -180,7 +191,7 @@ LeetCode Problems' Solutions | 1110 | [Delete Nodes And Return Forest](https://leetcode.com/problems/delete-nodes-and-return-forest "åˆ ē‚¹ęˆęž—") | [Go](https://github.com/openset/leetcode/tree/master/problems/delete-nodes-and-return-forest) | Medium | | 1109 | [Corporate Flight Bookings](https://leetcode.com/problems/corporate-flight-bookings "čˆŖē­é¢„č®¢ē»Ÿč®”") | [Go](https://github.com/openset/leetcode/tree/master/problems/corporate-flight-bookings) | Medium | | 1108 | [Defanging an IP Address](https://leetcode.com/problems/defanging-an-ip-address "IP åœ°å€ę— ę•ˆåŒ–") | [Go](https://github.com/openset/leetcode/tree/master/problems/defanging-an-ip-address) | Easy | -| 1107 | [New Users Daily Count](https://leetcode.com/problems/new-users-daily-count) šŸ”’ | [MySQL](https://github.com/openset/leetcode/tree/master/problems/new-users-daily-count) | Medium | +| 1107 | [New Users Daily Count](https://leetcode.com/problems/new-users-daily-count "ęÆę—„ę–°ē”Øęˆ·ē»Ÿč®”") šŸ”’ | [MySQL](https://github.com/openset/leetcode/tree/master/problems/new-users-daily-count) | Medium | | 1106 | [Parsing A Boolean Expression](https://leetcode.com/problems/parsing-a-boolean-expression "č§£ęžåøƒå°”č”Øč¾¾å¼") | [Go](https://github.com/openset/leetcode/tree/master/problems/parsing-a-boolean-expression) | Hard | | 1105 | [Filling Bookcase Shelves](https://leetcode.com/problems/filling-bookcase-shelves "å”«å……ä¹¦ęž¶") | [Go](https://github.com/openset/leetcode/tree/master/problems/filling-bookcase-shelves) | Medium | | 1104 | [Path In Zigzag Labelled Binary Tree](https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree "äŗŒå‰ę ‘åÆ»č·Æ") | [Go](https://github.com/openset/leetcode/tree/master/problems/path-in-zigzag-labelled-binary-tree) | Medium | diff --git a/problems/airplane-seat-assignment-probability/README.md b/problems/airplane-seat-assignment-probability/README.md new file mode 100644 index 000000000..147a55c71 --- /dev/null +++ b/problems/airplane-seat-assignment-probability/README.md @@ -0,0 +1,60 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/the-dining-philosophers "The Dining Philosophers") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/missing-number-in-arithmetic-progression "Missing Number In Arithmetic Progression") + +## [1227. Airplane Seat Assignment Probability (Medium)](https://leetcode.com/problems/airplane-seat-assignment-probability "") + +

n passengers board an airplane with exactly n seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of passengers will:

+ + + +

What is the probability that the n-th person can get his own seat?

+ +

 

+

Example 1:

+ +
+Input: n = 1
+Output: 1.00000
+Explanation: The first person can only get the first seat.
+ +

Example 2:

+ +
+Input: n = 2
+Output: 0.50000
+Explanation: The second person has a probability of 0.5 to get the second seat (when first person gets the first seat).
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] + [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] + [[Brainteaser](https://github.com/openset/leetcode/tree/master/tag/brainteaser/README.md)] + +### Hints +
+Hint 1 +Use dynamic programming, dp[i] indicates the probability that the i-th person can get his seat when there're i persons in total. It's okay to start with O(n^2) solution and then optimize it. +
+ +
+Hint 2 +Try to find the regular pattern of the result. +
diff --git a/problems/check-if-it-is-a-straight-line/README.md b/problems/check-if-it-is-a-straight-line/README.md new file mode 100644 index 000000000..f1a384a10 --- /dev/null +++ b/problems/check-if-it-is-a-straight-line/README.md @@ -0,0 +1,66 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/divide-chocolate "Divide Chocolate") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/remove-sub-folders-from-the-filesystem "Remove Sub-Folders from the Filesystem") + +## [1232. Check If It Is a Straight Line (Easy)](https://leetcode.com/problems/check-if-it-is-a-straight-line "ē¼€ē‚¹ęˆēŗæ") + +

You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.

+ +

 

+ +

 

+

Example 1:

+ +

+ +
+Input: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]
+Output: true
+
+ +

Example 2:

+ +

+ +
+Input: coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]]
+Output: false
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Geometry](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] + [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] + [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] + +### Hints +
+Hint 1 +If there're only 2 points, return true. +
+ +
+Hint 2 +Check if all other points lie on the line defined by the first 2 points. +
+ +
+Hint 3 +Use cross product to check collinearity. +
diff --git a/problems/design-bounded-blocking-queue/README.md b/problems/design-bounded-blocking-queue/README.md index d0ae021d2..d15d328af 100644 --- a/problems/design-bounded-blocking-queue/README.md +++ b/problems/design-bounded-blocking-queue/README.md @@ -9,6 +9,6 @@ 怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 [Next >](https://github.com/openset/leetcode/tree/master/problems/maximum-number-of-balloons "Maximum Number of Balloons") -## [1188. Design Bounded Blocking Queue (Medium)](https://leetcode.com/problems/design-bounded-blocking-queue "") +## [1188. Design Bounded Blocking Queue (Medium)](https://leetcode.com/problems/design-bounded-blocking-queue "č®¾č®”ęœ‰é™é˜»å”žé˜Ÿåˆ—") diff --git a/problems/divide-chocolate/README.md b/problems/divide-chocolate/README.md new file mode 100644 index 000000000..362602561 --- /dev/null +++ b/problems/divide-chocolate/README.md @@ -0,0 +1,34 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/toss-strange-coins "Toss Strange Coins") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-straight-line "Check If It Is a Straight Line") + +## [1231. Divide Chocolate (Hard)](https://leetcode.com/problems/divide-chocolate "åˆ†äŗ«å·§å…‹åŠ›") + + + +### Related Topics + [[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] + [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] + +### Hints +
+Hint 1 +After dividing the array into K+1 sub-arrays, you will pick the sub-array with the minimum sum. +
+ +
+Hint 2 +Divide the sub-array into K+1 sub-arrays such that the minimum sub-array sum is as maximum as possible. +
+ +
+Hint 3 +Use binary search with greedy check. +
diff --git a/problems/maximum-profit-in-job-scheduling/README.md b/problems/maximum-profit-in-job-scheduling/README.md new file mode 100644 index 000000000..2ec8b7d67 --- /dev/null +++ b/problems/maximum-profit-in-job-scheduling/README.md @@ -0,0 +1,81 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/replace-the-substring-for-balanced-string "Replace the Substring for Balanced String") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/web-crawler "Web Crawler") + +## [1235. Maximum Profit in Job Scheduling (Hard)](https://leetcode.com/problems/maximum-profit-in-job-scheduling "č§„åˆ’å…¼čŒå·„ä½œ") + +

We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].

+ +

You're given the startTime , endTime and profit arrays, you need to output the maximum profit you can take such that there are no 2 jobs in the subset with overlapping time range.

+ +

If you choose a job that ends at time X you will be able to start another job that starts at time X.

+ +

 

+

Example 1:

+ +

+ +
+Input: startTime = [1,2,3,3], endTime = [3,4,5,6], profit = [50,10,40,70]
+Output: 120
+Explanation: The subset chosen is the first and fourth job. 
+Time range [1-3]+[3-6] , we get profit of 120 = 50 + 70.
+
+ +

Example 2:

+ +

+ +
+
+Input: startTime = [1,2,3,4,6], endTime = [3,5,10,6,9], profit = [20,20,100,70,60]
+Output: 150
+Explanation: The subset chosen is the first, fourth and fifth job. 
+Profit obtained 150 = 20 + 70 + 60.
+
+ +

Example 3:

+ +

+ +
+Input: startTime = [1,1,1], endTime = [2,3,4], profit = [5,6,4]
+Output: 6
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] + [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] + [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] + +### Hints +
+Hint 1 +Think on DP. +
+ +
+Hint 2 +Sort the elements by starting time, then define the dp[i] as the maximum profit taking elements from the suffix starting at i. +
+ +
+Hint 3 +Use binarySearch (lower_bound/upper_bound on C++) to get the next index for the DP transition. +
diff --git a/problems/meeting-scheduler/README.md b/problems/meeting-scheduler/README.md new file mode 100644 index 000000000..a75c5de56 --- /dev/null +++ b/problems/meeting-scheduler/README.md @@ -0,0 +1,33 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/missing-number-in-arithmetic-progression "Missing Number In Arithmetic Progression") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/toss-strange-coins "Toss Strange Coins") + +## [1229. Meeting Scheduler (Medium)](https://leetcode.com/problems/meeting-scheduler "å®‰ęŽ’ä¼šč®®ę—„ēØ‹") + + + +### Related Topics + [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] + +### Hints +
+Hint 1 +Assume that in the solution, the selected slot from slotsA is bigger than the respectively selected slot from slotsB. +
+ +
+Hint 2 +Use two pointers in order to try all the possible intersections, and check the length. +
+ +
+Hint 3 +Do the same in step N° 1 but now assume that the selected slot from slotsB is bigger, return the minimum of the two options. +
diff --git a/problems/missing-number-in-arithmetic-progression/README.md b/problems/missing-number-in-arithmetic-progression/README.md new file mode 100644 index 000000000..a6887daf6 --- /dev/null +++ b/problems/missing-number-in-arithmetic-progression/README.md @@ -0,0 +1,33 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/airplane-seat-assignment-probability "Airplane Seat Assignment Probability") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/meeting-scheduler "Meeting Scheduler") + +## [1228. Missing Number In Arithmetic Progression (Easy)](https://leetcode.com/problems/missing-number-in-arithmetic-progression "ē­‰å·®ę•°åˆ—äø­ē¼ŗå¤±ēš„ę•°å­—") + + + +### Related Topics + [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] + +### Hints +
+Hint 1 +Assume the sequence is increasing, what if we find the largest consecutive difference? +
+ +
+Hint 2 +Is the missing element in the middle of the segment with the largest consecutive difference? +
+ +
+Hint 3 +For decreasing sequences, just reverse the array and do a similar process. +
diff --git a/problems/new-users-daily-count/README.md b/problems/new-users-daily-count/README.md index 5e541c651..c7d1a244d 100644 --- a/problems/new-users-daily-count/README.md +++ b/problems/new-users-daily-count/README.md @@ -9,6 +9,6 @@ 怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 [Next >](https://github.com/openset/leetcode/tree/master/problems/defanging-an-ip-address "Defanging an IP Address") -## [1107. New Users Daily Count (Medium)](https://leetcode.com/problems/new-users-daily-count "") +## [1107. New Users Daily Count (Medium)](https://leetcode.com/problems/new-users-daily-count "ęÆę—„ę–°ē”Øęˆ·ē»Ÿč®”") diff --git a/problems/remove-sub-folders-from-the-filesystem/README.md b/problems/remove-sub-folders-from-the-filesystem/README.md new file mode 100644 index 000000000..77c766089 --- /dev/null +++ b/problems/remove-sub-folders-from-the-filesystem/README.md @@ -0,0 +1,68 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-straight-line "Check If It Is a Straight Line") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/replace-the-substring-for-balanced-string "Replace the Substring for Balanced String") + +## [1233. Remove Sub-Folders from the Filesystem (Medium)](https://leetcode.com/problems/remove-sub-folders-from-the-filesystem "åˆ é™¤å­ę–‡ä»¶å¤¹") + +

Given a list of folders, remove all sub-folders in those folders and return in any order the folders after removing.

+ +

If a folder[i] is located within another folder[j], it is called a sub-folder of it.

+ +

The format of a path is one or more concatenated strings of the form: / followed by one or more lowercase English letters. For example, /leetcode and /leetcode/problems are valid paths while an empty string and / are not.

+ +

 

+

Example 1:

+ +
+Input: folder = ["/a","/a/b","/c/d","/c/d/e","/c/f"]
+Output: ["/a","/c/d","/c/f"]
+Explanation: Folders "/a/b/" is a subfolder of "/a" and "/c/d/e" is inside of folder "/c/d" in our filesystem.
+
+ +

Example 2:

+ +
+Input: folder = ["/a","/a/b/c","/a/b/d"]
+Output: ["/a"]
+Explanation: Folders "/a/b/c" and "/a/b/d/" will be removed because they are subfolders of "/a".
+
+ +

Example 3:

+ +
+Input: folder = ["/a/b/c","/a/b/ca","/a/b/d"]
+Output: ["/a/b/c","/a/b/ca","/a/b/d"]
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] + [[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] + +### Hints +
+Hint 1 +Sort the folders lexicographically. +
+ +
+Hint 2 +Insert the current element in an array and then loop until we get rid of all of their subfolders, repeat this until no element is left. +
diff --git a/problems/replace-the-substring-for-balanced-string/README.md b/problems/replace-the-substring-for-balanced-string/README.md new file mode 100644 index 000000000..49e1838fd --- /dev/null +++ b/problems/replace-the-substring-for-balanced-string/README.md @@ -0,0 +1,76 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/remove-sub-folders-from-the-filesystem "Remove Sub-Folders from the Filesystem") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/maximum-profit-in-job-scheduling "Maximum Profit in Job Scheduling") + +## [1234. Replace the Substring for Balanced String (Medium)](https://leetcode.com/problems/replace-the-substring-for-balanced-string "ę›æę¢å­äø²å¾—åˆ°å¹³č””å­—ē¬¦äø²") + +

You are given a string containing only 4 kinds of characters 'Q', 'W', 'E' and 'R'.

+ +

A string is said to be balanced if each of its characters appears n/4 times where n is the length of the string.

+ +

Return the minimum length of the substring that can be replaced with any other string of the same length to make the original string s balanced.

+ +

Return 0 if the string is already balanced.

+ +

 

+

Example 1:

+ +
+Input: s = "QWER"
+Output: 0
+Explanation: s is already balanced.
+ +

Example 2:

+ +
+Input: s = "QQWE"
+Output: 1
+Explanation: We need to replace a 'Q' to 'R', so that "RQWE" (or "QRWE") is balanced.
+
+ +

Example 3:

+ +
+Input: s = "QQQW"
+Output: 2
+Explanation: We can replace the first "QQ" to "ER". 
+
+ +

Example 4:

+ +
+Input: s = "QQQQ"
+Output: 3
+Explanation: We can replace the last 3 'Q' to make s = "QWER".
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Two Pointers](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] + [[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] + +### Hints +
+Hint 1 +Use 2-pointers algorithm to make sure all amount of characters outside the 2 pointers are smaller or equal to n/4. +
+ +
+Hint 2 +That means you need to count the amount of each letter and make sure the amount is enough. +
diff --git a/problems/report-contiguous-dates/README.md b/problems/report-contiguous-dates/README.md index 3c788b1bb..8d3194087 100644 --- a/problems/report-contiguous-dates/README.md +++ b/problems/report-contiguous-dates/README.md @@ -7,7 +7,7 @@ [< Previous](https://github.com/openset/leetcode/tree/master/problems/maximum-equal-frequency "Maximum Equal Frequency") 怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 -Next > +[Next >](https://github.com/openset/leetcode/tree/master/problems/the-dining-philosophers "The Dining Philosophers") ## [1225. Report Contiguous Dates (Hard)](https://leetcode.com/problems/report-contiguous-dates "") diff --git a/problems/the-dining-philosophers/README.md b/problems/the-dining-philosophers/README.md new file mode 100644 index 000000000..5e24a6b5a --- /dev/null +++ b/problems/the-dining-philosophers/README.md @@ -0,0 +1,59 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/report-contiguous-dates "Report Contiguous Dates") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/airplane-seat-assignment-probability "Airplane Seat Assignment Probability") + +## [1226. The Dining Philosophers (Medium)](https://leetcode.com/problems/the-dining-philosophers "") + +

Five silent philosophers sit at a round table with bowls of spaghetti. Forks are placed between each pair of adjacent philosophers.

+ +

Each philosopher must alternately think and eat. However, a philosopher can only eat spaghetti when they have both left and right forks. Each fork can be held by only one philosopher and so a philosopher can use the fork only if it is not being used by another philosopher. After an individual philosopher finishes eating, they need to put down both forks so that the forks become available to others. A philosopher can take the fork on their right or the one on their left as they become available, but cannot start eating before getting both forks.

+ +

Eating is not limited by the remaining amounts of spaghetti or stomach space; an infinite supply and an infinite demand are assumed.

+ +

Design a discipline of behavior (a concurrent algorithm) such that no philosopher will starve; i.e., each can forever continue to alternate between eating and thinking, assuming that no philosopher can know when others may want to eat or think.

+ +

+ +

The problem statement and the image above are taken from wikipedia.org

+ +

 

+ +

The philosophers' ids are numbered from 0 to 4 in a clockwise order. Implement the function void wantsToEat(philosopher, pickLeftFork, pickRightFork, eat, putLeftFork, putRightFork) where:

+ + + +

Five threads, each representing a philosopher, will simultaneously use one object of your class to simulate the process. It is possible that the function will be called for the same philosopher more than once, even before the last call ends.

+ +

 

+

Example 1:

+ +
+Input: n = 1
+Output: [[4,2,1],[4,1,1],[0,1,1],[2,2,1],[2,1,1],[2,0,3],[2,1,2],[2,2,2],[4,0,3],[4,1,2],[0,2,1],[4,2,2],[3,2,1],[3,1,1],[0,0,3],[0,1,2],[0,2,2],[1,2,1],[1,1,1],[3,0,3],[3,1,2],[3,2,2],[1,0,3],[1,1,2],[1,2,2]]
+Explanation:
+n is the number of times each philosopher will call the function.
+The output array describes the calls you made to the functions controlling the forks and the eat function, its format is:
+output[i] = [a, b, c] (three integers)
+- a is the id of a philosopher.
+- b specifies the fork: {1 : left, 2 : right}.
+- c specifies the operation: {1 : pick, 2 : put, 3 : eat}.
+ +

 

+

Constraints:

+ + diff --git a/problems/toss-strange-coins/README.md b/problems/toss-strange-coins/README.md new file mode 100644 index 000000000..25556811e --- /dev/null +++ b/problems/toss-strange-coins/README.md @@ -0,0 +1,39 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/meeting-scheduler "Meeting Scheduler") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +[Next >](https://github.com/openset/leetcode/tree/master/problems/divide-chocolate "Divide Chocolate") + +## [1230. Toss Strange Coins (Medium)](https://leetcode.com/problems/toss-strange-coins "ęŠ›ęŽ·ē”¬åø") + + + +### Related Topics + [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] + [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] + +### Hints +
+Hint 1 +What about solving the problem with DP? +
+ +
+Hint 2 +Use DP with two states dp[pos][cnt], where pos represents the pos-th coin and cnt is the number of heads seen so far. +
+ +
+Hint 3 +You can do the transitions with a little bit math. +
+ +
+Hint 4 +For the base case, when pos == n return (cnt == target) to filter out the invalid scenarios. +
diff --git a/problems/web-crawler/README.md b/problems/web-crawler/README.md new file mode 100644 index 000000000..810f1c0c2 --- /dev/null +++ b/problems/web-crawler/README.md @@ -0,0 +1,14 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/maximum-profit-in-job-scheduling "Maximum Profit in Job Scheduling") +怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀怀 +Next > + +## [1236. Web Crawler (Medium)](https://leetcode.com/problems/web-crawler "") + + diff --git a/tag/README.md b/tag/README.md index e56d94bbc..de32cf553 100644 --- a/tag/README.md +++ b/tag/README.md @@ -16,8 +16,8 @@ | 9 | [Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md) | [č“Ŗåæƒē®—ę³•](https://openset.github.io/tags/greedy/) | | 10 | [Two Pointers](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md) | [åŒęŒ‡é’ˆ](https://openset.github.io/tags/two-pointers/) | | 11 | [Breadth-first Search](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md) | [å¹æåŗ¦ä¼˜å…ˆęœē“¢](https://openset.github.io/tags/breadth-first-search/) | | 12 | [Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md) | [ꠈ](https://openset.github.io/tags/stack/) | | 13 | [Backtracking](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md) | [å›žęŗÆē®—ę³•](https://openset.github.io/tags/backtracking/) | | 14 | [Design](https://github.com/openset/leetcode/tree/master/tag/design/README.md) | [设讔](https://openset.github.io/tags/design/) | -| 15 | [Graph](https://github.com/openset/leetcode/tree/master/tag/graph/README.md) | [图](https://openset.github.io/tags/graph/) | | 16 | [Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md) | [链蔨](https://openset.github.io/tags/linked-list/) | -| 17 | [Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md) | [ęŽ’åŗ](https://openset.github.io/tags/sort/) | | 18 | [Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md) | [ä½čæē®—](https://openset.github.io/tags/bit-manipulation/) | +| 15 | [Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md) | [ęŽ’åŗ](https://openset.github.io/tags/sort/) | | 16 | [Graph](https://github.com/openset/leetcode/tree/master/tag/graph/README.md) | [图](https://openset.github.io/tags/graph/) | +| 17 | [Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md) | [链蔨](https://openset.github.io/tags/linked-list/) | | 18 | [Bit Manipulation](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md) | [ä½čæē®—](https://openset.github.io/tags/bit-manipulation/) | | 19 | [Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md) | [堆](https://openset.github.io/tags/heap/) | | 20 | [Union Find](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md) | [å¹¶ęŸ„é›†](https://openset.github.io/tags/union-find/) | | 21 | [Sliding Window](https://github.com/openset/leetcode/tree/master/tag/sliding-window/README.md) | [Sliding Window](https://openset.github.io/tags/sliding-window/) | | 22 | [Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md) | [åˆ†ę²»ē®—ę³•](https://openset.github.io/tags/divide-and-conquer/) | | 23 | [Trie](https://github.com/openset/leetcode/tree/master/tag/trie/README.md) | [å­—å…øę ‘](https://openset.github.io/tags/trie/) | | 24 | [Recursion](https://github.com/openset/leetcode/tree/master/tag/recursion/README.md) | [递归](https://openset.github.io/tags/recursion/) | diff --git a/tag/array/README.md b/tag/array/README.md index e46c56d54..30a5c4281 100644 --- a/tag/array/README.md +++ b/tag/array/README.md @@ -9,6 +9,8 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1233 | [åˆ é™¤å­ę–‡ä»¶å¤¹](https://github.com/openset/leetcode/tree/master/problems/remove-sub-folders-from-the-filesystem) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | +| 1232 | [ē¼€ē‚¹ęˆēŗæ](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-straight-line) | [[几何](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 1222 | [åÆä»„ę”»å‡»å›½ēŽ‹ēš„ēš‡åŽ](https://github.com/openset/leetcode/tree/master/problems/queens-that-can-attack-the-king) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Medium | | 1217 | [ēŽ©ē­¹ē ](https://github.com/openset/leetcode/tree/master/problems/play-with-chips) | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 1208 | [å°½åÆčƒ½ä½æå­—ē¬¦äø²ē›øē­‰](https://github.com/openset/leetcode/tree/master/problems/get-equal-substrings-within-budget) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[Sliding Window](https://github.com/openset/leetcode/tree/master/tag/sliding-window/README.md)] | Medium | diff --git a/tag/binary-search/README.md b/tag/binary-search/README.md index ccb8d27ee..1d7b06ddd 100644 --- a/tag/binary-search/README.md +++ b/tag/binary-search/README.md @@ -9,6 +9,8 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1235 | [č§„åˆ’å…¼čŒå·„ä½œ](https://github.com/openset/leetcode/tree/master/problems/maximum-profit-in-job-scheduling) | [[ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | +| 1231 | [åˆ†äŗ«å·§å…‹åŠ›](https://github.com/openset/leetcode/tree/master/problems/divide-chocolate) šŸ”’ | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Hard | | 1201 | [äø‘ę•° III](https://github.com/openset/leetcode/tree/master/problems/ugly-number-iii) | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium | | 1198 | [ę‰¾å‡ŗę‰€ęœ‰č”Œäø­ęœ€å°å…¬å…±å…ƒē“ ](https://github.com/openset/leetcode/tree/master/problems/find-smallest-common-element-in-all-rows) šŸ”’ | [[å“ˆåøŒč”Ø](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium | | 1182 | [äøŽē›®ę ‡é¢œč‰²é—“ēš„ęœ€ēŸ­č·ē¦»](https://github.com/openset/leetcode/tree/master/problems/shortest-distance-to-target-color) šŸ”’ | [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium | diff --git a/tag/dynamic-programming/README.md b/tag/dynamic-programming/README.md index 8456174b8..8b812f183 100644 --- a/tag/dynamic-programming/README.md +++ b/tag/dynamic-programming/README.md @@ -9,6 +9,8 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1235 | [č§„åˆ’å…¼čŒå·„ä½œ](https://github.com/openset/leetcode/tree/master/problems/maximum-profit-in-job-scheduling) | [[ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | +| 1230 | [ęŠ›ęŽ·ē”¬åø](https://github.com/openset/leetcode/tree/master/problems/toss-strange-coins) šŸ”’ | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | | 1223 | [ęŽ·éŖ°å­ęØ”ę‹Ÿ](https://github.com/openset/leetcode/tree/master/problems/dice-roll-simulation) | [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | | 1220 | [ē»Ÿč®”å…ƒéŸ³å­—ęÆåŗåˆ—ēš„ę•°ē›®](https://github.com/openset/leetcode/tree/master/problems/count-vowels-permutation) | [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | | 1218 | [ęœ€é•æå®šå·®å­åŗåˆ—](https://github.com/openset/leetcode/tree/master/problems/longest-arithmetic-subsequence-of-given-difference) | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | diff --git a/tag/geometry/README.md b/tag/geometry/README.md index d3cc93283..5da22017e 100644 --- a/tag/geometry/README.md +++ b/tag/geometry/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1232 | [ē¼€ē‚¹ęˆēŗæ](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-straight-line) | [[几何](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 963 | [ęœ€å°é¢ē§ÆēŸ©å½¢ II](https://github.com/openset/leetcode/tree/master/problems/minimum-area-rectangle-ii) | [[几何](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Medium | | 892 | [äø‰ē»“å½¢ä½“ēš„č”Øé¢ē§Æ](https://github.com/openset/leetcode/tree/master/problems/surface-area-of-3d-shapes) | [[几何](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 587 | [å®‰č£…ę …ę ](https://github.com/openset/leetcode/tree/master/problems/erect-the-fence) | [[几何](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] | Hard | diff --git a/tag/greedy/README.md b/tag/greedy/README.md index b8d913ef7..fe6069743 100644 --- a/tag/greedy/README.md +++ b/tag/greedy/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1231 | [åˆ†äŗ«å·§å…‹åŠ›](https://github.com/openset/leetcode/tree/master/problems/divide-chocolate) šŸ”’ | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Hard | | 1221 | [åˆ†å‰²å¹³č””å­—ē¬¦äø²](https://github.com/openset/leetcode/tree/master/problems/split-a-string-in-balanced-strings) | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | | 1217 | [ēŽ©ē­¹ē ](https://github.com/openset/leetcode/tree/master/problems/play-with-chips) | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 1196 | [ęœ€å¤šåÆä»„ä¹°åˆ°ēš„č‹¹ęžœę•°é‡](https://github.com/openset/leetcode/tree/master/problems/how-many-apples-can-you-put-into-the-basket) šŸ”’ | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] | Easy | diff --git a/tag/line-sweep/README.md b/tag/line-sweep/README.md index 4e726236d..3c129d642 100644 --- a/tag/line-sweep/README.md +++ b/tag/line-sweep/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1229 | [å®‰ęŽ’ä¼šč®®ę—„ēØ‹](https://github.com/openset/leetcode/tree/master/problems/meeting-scheduler) šŸ”’ | [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] | Medium | | 850 | [ēŸ©å½¢é¢ē§Æ II](https://github.com/openset/leetcode/tree/master/problems/rectangle-area-ii) | [[线段树](https://github.com/openset/leetcode/tree/master/tag/segment-tree/README.md)] [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] | Hard | | 391 | [å®Œē¾ŽēŸ©å½¢](https://github.com/openset/leetcode/tree/master/problems/perfect-rectangle) | [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] | Hard | | 218 | [å¤©é™…ēŗæé—®é¢˜](https://github.com/openset/leetcode/tree/master/problems/the-skyline-problem) | [[堆](https://github.com/openset/leetcode/tree/master/tag/heap/README.md)] [[ę ‘ēŠ¶ę•°ē»„](https://github.com/openset/leetcode/tree/master/tag/binary-indexed-tree/README.md)] [[线段树](https://github.com/openset/leetcode/tree/master/tag/segment-tree/README.md)] [[åˆ†ę²»ē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)] [[Line Sweep](https://github.com/openset/leetcode/tree/master/tag/line-sweep/README.md)] | Hard | diff --git a/tag/math/README.md b/tag/math/README.md index e6b4eacdd..64992d52b 100644 --- a/tag/math/README.md +++ b/tag/math/README.md @@ -9,6 +9,9 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1232 | [ē¼€ē‚¹ęˆēŗæ](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-straight-line) | [[几何](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | +| 1230 | [ęŠ›ęŽ·ē”¬åø](https://github.com/openset/leetcode/tree/master/problems/toss-strange-coins) šŸ”’ | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | +| 1228 | [ē­‰å·®ę•°åˆ—äø­ē¼ŗå¤±ēš„ę•°å­—](https://github.com/openset/leetcode/tree/master/problems/missing-number-in-arithmetic-progression) šŸ”’ | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 1218 | [ęœ€é•æå®šå·®å­åŗåˆ—](https://github.com/openset/leetcode/tree/master/problems/longest-arithmetic-subsequence-of-given-difference) | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | | 1217 | [ēŽ©ē­¹ē ](https://github.com/openset/leetcode/tree/master/problems/play-with-chips) | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | | 1201 | [äø‘ę•° III](https://github.com/openset/leetcode/tree/master/problems/ugly-number-iii) | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium | diff --git a/tag/sort/README.md b/tag/sort/README.md index 81f3cc8b5..805537ab9 100644 --- a/tag/sort/README.md +++ b/tag/sort/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1235 | [č§„åˆ’å…¼čŒå·„ä½œ](https://github.com/openset/leetcode/tree/master/problems/maximum-profit-in-job-scheduling) | [[ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[äŗŒåˆ†ęŸ„ę‰¾](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | | 1183 | [矩阵中 1 ēš„ęœ€å¤§ę•°é‡](https://github.com/openset/leetcode/tree/master/problems/maximum-number-of-ones) šŸ”’ | [[ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Hard | | 1152 | [ē”Øęˆ·ē½‘ē«™č®æé—®č”Œäøŗåˆ†ęž](https://github.com/openset/leetcode/tree/master/problems/analyze-user-website-visit-pattern) šŸ”’ | [[ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[å“ˆåøŒč”Ø](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Medium | | 1122 | [ę•°ē»„ēš„ē›øåÆ¹ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/problems/relative-sort-array) | [[ęŽ’åŗ](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Easy | diff --git a/tag/string/README.md b/tag/string/README.md index cdb2af54b..f9a1d2fa8 100644 --- a/tag/string/README.md +++ b/tag/string/README.md @@ -9,6 +9,8 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1234 | [ę›æę¢å­äø²å¾—åˆ°å¹³č””å­—ē¬¦äø²](https://github.com/openset/leetcode/tree/master/problems/replace-the-substring-for-balanced-string) | [[åŒęŒ‡é’ˆ](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | +| 1233 | [åˆ é™¤å­ę–‡ä»¶å¤¹](https://github.com/openset/leetcode/tree/master/problems/remove-sub-folders-from-the-filesystem) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | | 1221 | [åˆ†å‰²å¹³č””å­—ē¬¦äø²](https://github.com/openset/leetcode/tree/master/problems/split-a-string-in-balanced-strings) | [[č“Ŗåæƒē®—ę³•](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | | 1216 | [éŖŒčÆå›žę–‡å­—ē¬¦äø² III](https://github.com/openset/leetcode/tree/master/problems/valid-palindrome-iii) šŸ”’ | [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] [[åŠØę€č§„åˆ’](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | | 1189 | [ā€œę°”ēƒā€ ēš„ęœ€å¤§ę•°é‡](https://github.com/openset/leetcode/tree/master/problems/maximum-number-of-balloons) | [[å“ˆåøŒč”Ø](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | diff --git a/tag/tags.json b/tag/tags.json index cc95069b6..143d9c1d1 100644 --- a/tag/tags.json +++ b/tag/tags.json @@ -69,6 +69,11 @@ "Slug": "design", "TranslatedName": "设讔" }, + { + "Name": "Sort", + "Slug": "sort", + "TranslatedName": "ęŽ’åŗ" + }, { "Name": "Graph", "Slug": "graph", @@ -79,11 +84,6 @@ "Slug": "linked-list", "TranslatedName": "链蔨" }, - { - "Name": "Sort", - "Slug": "sort", - "TranslatedName": "ęŽ’åŗ" - }, { "Name": "Bit Manipulation", "Slug": "bit-manipulation", diff --git a/tag/two-pointers/README.md b/tag/two-pointers/README.md index 60818f1a5..d85a6ccd7 100644 --- a/tag/two-pointers/README.md +++ b/tag/two-pointers/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1234 | [ę›æę¢å­äø²å¾—åˆ°å¹³č””å­—ē¬¦äø²](https://github.com/openset/leetcode/tree/master/problems/replace-the-substring-for-balanced-string) | [[åŒęŒ‡é’ˆ](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | | 1213 | [äø‰äøŖęœ‰åŗę•°ē»„ēš„äŗ¤é›†](https://github.com/openset/leetcode/tree/master/problems/intersection-of-three-sorted-arrays) šŸ”’ | [[å“ˆåøŒč”Ø](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] [[åŒęŒ‡é’ˆ](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] | Easy | | 1093 | [大样本统讔](https://github.com/openset/leetcode/tree/master/problems/statistics-from-a-large-sample) | [[ę•°å­¦](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[åŒęŒ‡é’ˆ](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] | Medium | | 1004 | [ęœ€å¤§čæžē»­1ēš„äøŖę•° III](https://github.com/openset/leetcode/tree/master/problems/max-consecutive-ones-iii) | [[åŒęŒ‡é’ˆ](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] [[Sliding Window](https://github.com/openset/leetcode/tree/master/tag/sliding-window/README.md)] | Medium |