From d8220d468ba5b90b1da3f742e314fa3146670804 Mon Sep 17 00:00:00 2001 From: openset Date: Tue, 15 Oct 2019 10:18:12 +0800 Subject: [PATCH] Add: new --- README.md | 4 + problems/count-vowels-permutation/README.md | 2 +- problems/dice-roll-simulation/README.md | 64 +++++++++++++++ .../README.md | 2 +- .../README.md | 2 +- problems/maximum-equal-frequency/README.md | 68 ++++++++++++++++ .../minimum-absolute-difference/README.md | 2 +- problems/minimum-knight-moves/README.md | 2 +- .../minimum-time-to-build-blocks/README.md | 2 +- .../queens-that-can-attack-the-king/README.md | 77 +++++++++++++++++++ problems/reorder-data-in-log-files/README.md | 2 +- problems/smallest-string-with-swaps/README.md | 4 +- .../README.md | 2 +- .../README.md | 66 ++++++++++++++++ problems/ugly-number-iii/README.md | 5 +- problems/valid-anagram/README.md | 2 +- tag/array/README.md | 3 + tag/binary-search/README.md | 2 + tag/breadth-first-search/README.md | 1 + tag/depth-first-search/README.md | 1 + tag/dynamic-programming/README.md | 2 + tag/graph/README.md | 1 + tag/greedy/README.md | 2 + tag/hash-table/README.md | 2 + tag/math/README.md | 2 + tag/string/README.md | 3 +- tag/topological-sort/README.md | 1 + tag/union-find/README.md | 1 + 28 files changed, 311 insertions(+), 16 deletions(-) create mode 100644 problems/dice-roll-simulation/README.md create mode 100644 problems/maximum-equal-frequency/README.md create mode 100644 problems/queens-that-can-attack-the-king/README.md create mode 100644 problems/split-a-string-in-balanced-strings/README.md diff --git a/README.md b/README.md index 770dbb6ef..2cfad0583 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ LeetCode Problems' Solutions | # | Title | Solution | Difficulty | | :-: | - | - | :-: | +| 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 | +| 1221 | [Split a String in Balanced Strings](https://leetcode.com/problems/split-a-string-in-balanced-strings "分割平衡字符串") | [Go](https://github.com/openset/leetcode/tree/master/problems/split-a-string-in-balanced-strings) | Easy | | 1220 | [Count Vowels Permutation](https://leetcode.com/problems/count-vowels-permutation "统计元音字母序列的数目") | [Go](https://github.com/openset/leetcode/tree/master/problems/count-vowels-permutation) | Hard | | 1219 | [Path with Maximum Gold](https://leetcode.com/problems/path-with-maximum-gold "黄金矿工") | [Go](https://github.com/openset/leetcode/tree/master/problems/path-with-maximum-gold) | Medium | | 1218 | [Longest Arithmetic Subsequence of Given Difference](https://leetcode.com/problems/longest-arithmetic-subsequence-of-given-difference "最长定差子序列") | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-arithmetic-subsequence-of-given-difference) | Medium | diff --git a/problems/count-vowels-permutation/README.md b/problems/count-vowels-permutation/README.md index 5c3a17ed8..6f3587629 100644 --- a/problems/count-vowels-permutation/README.md +++ b/problems/count-vowels-permutation/README.md @@ -7,7 +7,7 @@ [< Previous](https://github.com/openset/leetcode/tree/master/problems/path-with-maximum-gold "Path with Maximum Gold")                  -Next > +[Next >](https://github.com/openset/leetcode/tree/master/problems/split-a-string-in-balanced-strings "Split a String in Balanced Strings") ## [1220. Count Vowels Permutation (Hard)](https://leetcode.com/problems/count-vowels-permutation "统计元音字母序列的数目") diff --git a/problems/dice-roll-simulation/README.md b/problems/dice-roll-simulation/README.md new file mode 100644 index 000000000..046ad67e1 --- /dev/null +++ b/problems/dice-roll-simulation/README.md @@ -0,0 +1,64 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/queens-that-can-attack-the-king "Queens That Can Attack the King") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/maximum-equal-frequency "Maximum Equal Frequency") + +## [1223. Dice Roll Simulation (Medium)](https://leetcode.com/problems/dice-roll-simulation "掷骰子模拟") + +

A die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number i more than rollMax[i] (1-indexed) consecutive times. 

+ +

Given an array of integers rollMax and an integer n, return the number of distinct sequences that can be obtained with exact n rolls.

+ +

Two sequences are considered different if at least one element differs from each other. Since the answer may be too large, return it modulo 10^9 + 7.

+ +

 

+

Example 1:

+ +
+Input: n = 2, rollMax = [1,1,2,2,2,3]
+Output: 34
+Explanation: There will be 2 rolls of die, if there are no constraints on the die, there are 6 * 6 = 36 possible combinations. In this case, looking at rollMax array, the numbers 1 and 2 appear at most once consecutively, therefore sequences (1,1) and (2,2) cannot occur, so the final answer is 36-2 = 34.
+
+ +

Example 2:

+ +
+Input: n = 2, rollMax = [1,1,1,1,1,1]
+Output: 30
+
+ +

Example 3:

+ +
+Input: n = 3, rollMax = [1,1,1,2,2,3]
+Output: 181
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] + +### Hints +
+Hint 1 +Think on Dynamic Programming. +
+ +
+Hint 2 +DP(pos, last) which means we are at the position pos having as last the last character seen. +
diff --git a/problems/find-smallest-common-element-in-all-rows/README.md b/problems/find-smallest-common-element-in-all-rows/README.md index 69f8c2c4b..aa483498c 100644 --- a/problems/find-smallest-common-element-in-all-rows/README.md +++ b/problems/find-smallest-common-element-in-all-rows/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/minimum-time-to-build-blocks "Minimum Time to Build Blocks") -## [1198. Find Smallest Common Element in All Rows (Medium)](https://leetcode.com/problems/find-smallest-common-element-in-all-rows "") +## [1198. Find Smallest Common Element in All Rows (Medium)](https://leetcode.com/problems/find-smallest-common-element-in-all-rows "找出所有行中最小公共元素") diff --git a/problems/how-many-apples-can-you-put-into-the-basket/README.md b/problems/how-many-apples-can-you-put-into-the-basket/README.md index bb61bf3a8..aa1329474 100644 --- a/problems/how-many-apples-can-you-put-into-the-basket/README.md +++ b/problems/how-many-apples-can-you-put-into-the-basket/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/minimum-knight-moves "Minimum Knight Moves") -## [1196. How Many Apples Can You Put into the Basket (Easy)](https://leetcode.com/problems/how-many-apples-can-you-put-into-the-basket "") +## [1196. How Many Apples Can You Put into the Basket (Easy)](https://leetcode.com/problems/how-many-apples-can-you-put-into-the-basket "最多可以买到的苹果数量") diff --git a/problems/maximum-equal-frequency/README.md b/problems/maximum-equal-frequency/README.md new file mode 100644 index 000000000..02f2a322d --- /dev/null +++ b/problems/maximum-equal-frequency/README.md @@ -0,0 +1,68 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/dice-roll-simulation "Dice Roll Simulation") +                 +Next > + +## [1224. Maximum Equal Frequency (Hard)](https://leetcode.com/problems/maximum-equal-frequency "最大相等频率") + +

Given an array nums of positive integers, return the longest possible length of an array prefix of nums, such that it is possible to remove exactly one element from this prefix so that every number that has appeared in it will have the same number of occurrences.

+ +

If after removing one element there are no remaining elements, it's still considered that every appeared number has the same number of ocurrences (0).

+ +

 

+

Example 1:

+ +
+Input: nums = [2,2,1,1,5,3,3,5]
+Output: 7
+Explanation: For the subarray [2,2,1,1,5,3,3] of length 7, if we remove nums[4]=5, we will get [2,2,1,1,3,3], so that each number will appear exactly twice.
+
+ +

Example 2:

+ +
+Input: nums = [1,1,1,2,2,2,3,3,3,4,4,4,5]
+Output: 13
+
+ +

Example 3:

+ +
+Input: nums = [1,1,1,2,2,2]
+Output: 5
+
+ +

Example 4:

+ +
+Input: nums = [10,2,8,9,3,8,1,5,2,3,7,6]
+Output: 8
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] + +### Hints +
+Hint 1 +Keep track of the min and max frequencies. +
+ +
+Hint 2 +The number to be eliminated must have a frequency of 1, same as the others or the same +1. +
diff --git a/problems/minimum-absolute-difference/README.md b/problems/minimum-absolute-difference/README.md index f191e351c..cca15c21f 100644 --- a/problems/minimum-absolute-difference/README.md +++ b/problems/minimum-absolute-difference/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/ugly-number-iii "Ugly Number III") -## [1200. Minimum Absolute Difference (Easy)](https://leetcode.com/problems/minimum-absolute-difference "") +## [1200. Minimum Absolute Difference (Easy)](https://leetcode.com/problems/minimum-absolute-difference "最小绝对差")

Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements. 

diff --git a/problems/minimum-knight-moves/README.md b/problems/minimum-knight-moves/README.md index ed81645a2..d4bd3b3b9 100644 --- a/problems/minimum-knight-moves/README.md +++ b/problems/minimum-knight-moves/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/find-smallest-common-element-in-all-rows "Find Smallest Common Element in All Rows") -## [1197. Minimum Knight Moves (Medium)](https://leetcode.com/problems/minimum-knight-moves "") +## [1197. Minimum Knight Moves (Medium)](https://leetcode.com/problems/minimum-knight-moves "进击的骑士") diff --git a/problems/minimum-time-to-build-blocks/README.md b/problems/minimum-time-to-build-blocks/README.md index 2437fd59e..569920a43 100644 --- a/problems/minimum-time-to-build-blocks/README.md +++ b/problems/minimum-time-to-build-blocks/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/minimum-absolute-difference "Minimum Absolute Difference") -## [1199. Minimum Time to Build Blocks (Hard)](https://leetcode.com/problems/minimum-time-to-build-blocks "") +## [1199. Minimum Time to Build Blocks (Hard)](https://leetcode.com/problems/minimum-time-to-build-blocks "建造街区的最短时间") diff --git a/problems/queens-that-can-attack-the-king/README.md b/problems/queens-that-can-attack-the-king/README.md new file mode 100644 index 000000000..a69d5e1a3 --- /dev/null +++ b/problems/queens-that-can-attack-the-king/README.md @@ -0,0 +1,77 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/split-a-string-in-balanced-strings "Split a String in Balanced Strings") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/dice-roll-simulation "Dice Roll Simulation") + +## [1222. Queens That Can Attack the King (Medium)](https://leetcode.com/problems/queens-that-can-attack-the-king "可以攻击国王的皇后") + +

On an 8x8 chessboard, there can be multiple Black Queens and one White King.

+ +

Given an array of integer coordinates queens that represents the positions of the Black Queens, and a pair of coordinates king that represent the position of the White King, return the coordinates of all the queens (in any order) that can attack the King.

+ +

 

+

Example 1:

+ +

+ +
+Input: queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]], king = [0,0]
+Output: [[0,1],[1,0],[3,3]]
+Explanation:  
+The queen at [0,1] can attack the king cause they're in the same row. 
+The queen at [1,0] can attack the king cause they're in the same column. 
+The queen at [3,3] can attack the king cause they're in the same diagnal. 
+The queen at [0,4] can't attack the king cause it's blocked by the queen at [0,1]. 
+The queen at [4,0] can't attack the king cause it's blocked by the queen at [1,0]. 
+The queen at [2,4] can't attack the king cause it's not in the same row/column/diagnal as the king.
+
+ +

Example 2:

+ +

+ +
+Input: queens = [[0,0],[1,1],[2,2],[3,4],[3,5],[4,4],[4,5]], king = [3,3]
+Output: [[2,2],[3,4],[4,4]]
+
+ +

Example 3:

+ +

+ +
+Input: queens = [[5,6],[7,7],[2,1],[0,7],[1,6],[5,1],[3,7],[0,3],[4,0],[1,2],[6,3],[5,0],[0,4],[2,2],[1,1],[6,4],[5,4],[0,0],[2,6],[4,5],[5,2],[1,4],[7,5],[2,3],[0,5],[4,2],[1,0],[2,7],[0,1],[4,6],[6,1],[0,6],[4,3],[1,7]], king = [3,4]
+Output: [[2,3],[1,4],[1,6],[3,7],[4,3],[5,4],[4,5]]
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] + +### Hints +
+Hint 1 +Check 8 directions around the King. +
+ +
+Hint 2 +Find the nearest queen in each direction. +
diff --git a/problems/reorder-data-in-log-files/README.md b/problems/reorder-data-in-log-files/README.md index 3197017c1..ca0522b02 100644 --- a/problems/reorder-data-in-log-files/README.md +++ b/problems/reorder-data-in-log-files/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/range-sum-of-bst "Range Sum of BST") -## [937. Reorder Data in Log Files (Easy)](https://leetcode.com/problems/reorder-data-in-log-files "") +## [937. Reorder Data in Log Files (Easy)](https://leetcode.com/problems/reorder-data-in-log-files "重新排列日志文件")

You have an array of logs.  Each log is a space delimited string of words.

diff --git a/problems/smallest-string-with-swaps/README.md b/problems/smallest-string-with-swaps/README.md index 388dfaf7c..70c035d95 100644 --- a/problems/smallest-string-with-swaps/README.md +++ b/problems/smallest-string-with-swaps/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/sort-items-by-groups-respecting-dependencies "Sort Items by Groups Respecting Dependencies") -## [1202. Smallest String With Swaps (Medium)](https://leetcode.com/problems/smallest-string-with-swaps "") +## [1202. Smallest String With Swaps (Medium)](https://leetcode.com/problems/smallest-string-with-swaps "交换字符串中的元素")

You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string.

@@ -60,8 +60,8 @@ Swap s[0] and s[1], s = "abc" ### Related Topics - [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[Union Find](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] + [[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] ### Hints
diff --git a/problems/sort-items-by-groups-respecting-dependencies/README.md b/problems/sort-items-by-groups-respecting-dependencies/README.md index 3971f9c37..77143ac3d 100644 --- a/problems/sort-items-by-groups-respecting-dependencies/README.md +++ b/problems/sort-items-by-groups-respecting-dependencies/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/last-person-to-fit-in-the-elevator "Last Person to Fit in the Elevator") -## [1203. Sort Items by Groups Respecting Dependencies (Hard)](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies "") +## [1203. Sort Items by Groups Respecting Dependencies (Hard)](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies "项目管理")

There are n items each belonging to zero or one of m groups where group[i] is the group that the i-th item belongs to and it's equal to -1 if the i-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it.

diff --git a/problems/split-a-string-in-balanced-strings/README.md b/problems/split-a-string-in-balanced-strings/README.md new file mode 100644 index 000000000..cd8dc3bb4 --- /dev/null +++ b/problems/split-a-string-in-balanced-strings/README.md @@ -0,0 +1,66 @@ + + + + + + + +[< Previous](https://github.com/openset/leetcode/tree/master/problems/count-vowels-permutation "Count Vowels Permutation") +                 +[Next >](https://github.com/openset/leetcode/tree/master/problems/queens-that-can-attack-the-king "Queens That Can Attack the King") + +## [1221. Split a String in Balanced Strings (Easy)](https://leetcode.com/problems/split-a-string-in-balanced-strings "分割平衡字符串") + +

Balanced strings are those who have equal quantity of 'L' and 'R' characters.

+ +

Given a balanced string s split it in the maximum amount of balanced strings.

+ +

Return the maximum amount of splitted balanced strings.

+ +

 

+

Example 1:

+ +
+Input: s = "RLRRLLRLRL"
+Output: 4
+Explanation: s can be split into "RL", "RRLL", "RL", "RL", each substring contains same number of 'L' and 'R'.
+
+ +

Example 2:

+ +
+Input: s = "RLLLLRRRLR"
+Output: 3
+Explanation: s can be split into "RL", "LLLRRR", "LR", each substring contains same number of 'L' and 'R'.
+
+ +

Example 3:

+ +
+Input: s = "LLLLRRRR"
+Output: 1
+Explanation: s can be split into "LLLLRRRR".
+
+ +

 

+

Constraints:

+ + + +### Related Topics + [[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] + [[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] + +### Hints +
+Hint 1 +Loop from left to right maintaining a balance variable when it gets an L increase it by one otherwise decrease it by one. +
+ +
+Hint 2 +Whenever the balance variable reaches zero then we increase the answer by one. +
diff --git a/problems/ugly-number-iii/README.md b/problems/ugly-number-iii/README.md index b3db3d099..fe85cdc98 100644 --- a/problems/ugly-number-iii/README.md +++ b/problems/ugly-number-iii/README.md @@ -9,7 +9,7 @@                  [Next >](https://github.com/openset/leetcode/tree/master/problems/smallest-string-with-swaps "Smallest String With Swaps") -## [1201. Ugly Number III (Medium)](https://leetcode.com/problems/ugly-number-iii "") +## [1201. Ugly Number III (Medium)](https://leetcode.com/problems/ugly-number-iii "丑数 III")

Write a program to find the n-th ugly number.

@@ -59,9 +59,6 @@ [[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] -### Similar Questions - 1. [Ugly Number II](https://github.com/openset/leetcode/tree/master/problems/ugly-number-ii) (Medium) - ### Hints
Hint 1 diff --git a/problems/valid-anagram/README.md b/problems/valid-anagram/README.md index 0b04d6ffd..a2f9e68c3 100644 --- a/problems/valid-anagram/README.md +++ b/problems/valid-anagram/README.md @@ -40,4 +40,4 @@ What if the inputs contain unicode characters? How would you adapt your solution ### Similar Questions 1. [Group Anagrams](https://github.com/openset/leetcode/tree/master/problems/group-anagrams) (Medium) 1. [Palindrome Permutation](https://github.com/openset/leetcode/tree/master/problems/palindrome-permutation) (Easy) - 1. [Find All Anagrams in a String](https://github.com/openset/leetcode/tree/master/problems/find-all-anagrams-in-a-string) (Easy) + 1. [Find All Anagrams in a String](https://github.com/openset/leetcode/tree/master/problems/find-all-anagrams-in-a-string) (Medium) diff --git a/tag/array/README.md b/tag/array/README.md index f362a8734..e46c56d54 100644 --- a/tag/array/README.md +++ b/tag/array/README.md @@ -9,8 +9,11 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 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 | +| 1202 | [交换字符串中的元素](https://github.com/openset/leetcode/tree/master/problems/smallest-string-with-swaps) | [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Medium | +| 1200 | [最小绝对差](https://github.com/openset/leetcode/tree/master/problems/minimum-absolute-difference) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Easy | | 1185 | [一周中的第几天](https://github.com/openset/leetcode/tree/master/problems/day-of-the-week) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Easy | | 1184 | [公交站间的距离](https://github.com/openset/leetcode/tree/master/problems/distance-between-bus-stops) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Easy | | 1177 | [构建回文串检测](https://github.com/openset/leetcode/tree/master/problems/can-make-palindrome-from-substring) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | diff --git a/tag/binary-search/README.md b/tag/binary-search/README.md index fcc66534b..ccb8d27ee 100644 --- a/tag/binary-search/README.md +++ b/tag/binary-search/README.md @@ -9,6 +9,8 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 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 | | 1157 | [子数组中占绝大多数的元素](https://github.com/openset/leetcode/tree/master/problems/online-majority-element-in-subarray) | [[线段树](https://github.com/openset/leetcode/tree/master/tag/segment-tree/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[二分查找](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Hard | | 1150 | [检查一个数是否在数组中占绝大多数](https://github.com/openset/leetcode/tree/master/problems/check-if-a-number-is-majority-element-in-a-sorted-array) 🔒 | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[二分查找](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Easy | diff --git a/tag/breadth-first-search/README.md b/tag/breadth-first-search/README.md index 3fc5a2bf3..1ebc2d45f 100644 --- a/tag/breadth-first-search/README.md +++ b/tag/breadth-first-search/README.md @@ -10,6 +10,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | | 1210 | [穿过迷宫的最少移动次数](https://github.com/openset/leetcode/tree/master/problems/minimum-moves-to-reach-target-with-rotations) | [[广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md)] | Hard | +| 1197 | [进击的骑士](https://github.com/openset/leetcode/tree/master/problems/minimum-knight-moves) 🔒 | [[广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md)] | Medium | | 1162 | [地图分析](https://github.com/openset/leetcode/tree/master/problems/as-far-from-land-as-possible) | [[广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Medium | | 1129 | [颜色交替的最短路径](https://github.com/openset/leetcode/tree/master/problems/shortest-path-with-alternating-colors) | [[广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Medium | | 1091 | [二进制矩阵中的最短路径](https://github.com/openset/leetcode/tree/master/problems/shortest-path-in-binary-matrix) | [[广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md)] | Medium | diff --git a/tag/depth-first-search/README.md b/tag/depth-first-search/README.md index f7723b38a..4d4112482 100644 --- a/tag/depth-first-search/README.md +++ b/tag/depth-first-search/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1203 | [项目管理](https://github.com/openset/leetcode/tree/master/problems/sort-items-by-groups-respecting-dependencies) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] [[拓扑排序](https://github.com/openset/leetcode/tree/master/tag/topological-sort/README.md)] | Hard | | 1192 | [查找集群内的「关键连接」](https://github.com/openset/leetcode/tree/master/problems/critical-connections-in-a-network) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] | Hard | | 1145 | [二叉树着色游戏](https://github.com/openset/leetcode/tree/master/problems/binary-tree-coloring-game) | [[树](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)] [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] | Medium | | 1136 | [平行课程](https://github.com/openset/leetcode/tree/master/problems/parallel-courses) 🔒 | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] [[动态规划](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | diff --git a/tag/dynamic-programming/README.md b/tag/dynamic-programming/README.md index df0e7c825..8456174b8 100644 --- a/tag/dynamic-programming/README.md +++ b/tag/dynamic-programming/README.md @@ -9,9 +9,11 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 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 | | 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 | +| 1199 | [建造街区的最短时间](https://github.com/openset/leetcode/tree/master/problems/minimum-time-to-build-blocks) 🔒 | [[数学](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[动态规划](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | | 1191 | [K 次串联后最大子数组之和](https://github.com/openset/leetcode/tree/master/problems/k-concatenation-maximum-sum) | [[动态规划](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | | 1187 | [使数组严格递增](https://github.com/openset/leetcode/tree/master/problems/make-array-strictly-increasing) | [[动态规划](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Hard | | 1186 | [删除一次得到子数组最大和](https://github.com/openset/leetcode/tree/master/problems/maximum-subarray-sum-with-one-deletion) | [[动态规划](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)] | Medium | diff --git a/tag/graph/README.md b/tag/graph/README.md index 7dbae34b8..b135dc381 100644 --- a/tag/graph/README.md +++ b/tag/graph/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1203 | [项目管理](https://github.com/openset/leetcode/tree/master/problems/sort-items-by-groups-respecting-dependencies) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] [[拓扑排序](https://github.com/openset/leetcode/tree/master/tag/topological-sort/README.md)] | Hard | | 1168 | [水资源分配优化](https://github.com/openset/leetcode/tree/master/problems/optimize-water-distribution-in-a-village) 🔒 | [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Hard | | 1162 | [地图分析](https://github.com/openset/leetcode/tree/master/problems/as-far-from-land-as-possible) | [[广度优先搜索](https://github.com/openset/leetcode/tree/master/tag/breadth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Medium | | 1161 | [最大层内元素和](https://github.com/openset/leetcode/tree/master/problems/maximum-level-sum-of-a-binary-tree) | [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Medium | diff --git a/tag/greedy/README.md b/tag/greedy/README.md index 6318d3024..b8d913ef7 100644 --- a/tag/greedy/README.md +++ b/tag/greedy/README.md @@ -9,7 +9,9 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 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 | | 1167 | [连接棒材的最低费用](https://github.com/openset/leetcode/tree/master/problems/minimum-cost-to-connect-sticks) 🔒 | [[贪心算法](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] | Medium | | 1111 | [有效括号的嵌套深度](https://github.com/openset/leetcode/tree/master/problems/maximum-nesting-depth-of-two-valid-parentheses-strings) | [[贪心算法](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[二分查找](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium | | 1094 | [拼车](https://github.com/openset/leetcode/tree/master/problems/car-pooling) | [[贪心算法](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] | Medium | diff --git a/tag/hash-table/README.md b/tag/hash-table/README.md index 32a2263c8..d35e05865 100644 --- a/tag/hash-table/README.md +++ b/tag/hash-table/README.md @@ -9,8 +9,10 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1224 | [最大相等频率](https://github.com/openset/leetcode/tree/master/problems/maximum-equal-frequency) | [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Hard | | 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 | | 1207 | [独一无二的出现次数](https://github.com/openset/leetcode/tree/master/problems/unique-number-of-occurrences) | [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Easy | +| 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 | | 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 | | 1178 | [猜字谜](https://github.com/openset/leetcode/tree/master/problems/number-of-valid-words-for-each-puzzle) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Hard | | 1166 | [设计文件系统](https://github.com/openset/leetcode/tree/master/problems/design-file-system) 🔒 | [[设计](https://github.com/openset/leetcode/tree/master/tag/design/README.md)] [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Medium | diff --git a/tag/math/README.md b/tag/math/README.md index 4c3b0aa90..e6b4eacdd 100644 --- a/tag/math/README.md +++ b/tag/math/README.md @@ -11,6 +11,8 @@ | :-: | - | - | :-: | | 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 | +| 1199 | [建造街区的最短时间](https://github.com/openset/leetcode/tree/master/problems/minimum-time-to-build-blocks) 🔒 | [[数学](https://github.com/openset/leetcode/tree/master/tag/math/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 | | 1180 | [统计只含单一字母的子串](https://github.com/openset/leetcode/tree/master/problems/count-substrings-with-only-one-distinct-letter) 🔒 | [[数学](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | | 1175 | [质数排列](https://github.com/openset/leetcode/tree/master/problems/prime-arrangements) | [[数学](https://github.com/openset/leetcode/tree/master/tag/math/README.md)] | Easy | diff --git a/tag/string/README.md b/tag/string/README.md index f4c24ab70..cdb2af54b 100644 --- a/tag/string/README.md +++ b/tag/string/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 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 | | 1181 | [前后拼接](https://github.com/openset/leetcode/tree/master/problems/before-and-after-puzzle) 🔒 | [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | @@ -33,7 +34,7 @@ | 1016 | [子串能表示从 1 到 N 数字的二进制串](https://github.com/openset/leetcode/tree/master/problems/binary-string-with-substrings-representing-1-to-n) | [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | | 1003 | [检查替换后的词是否有效](https://github.com/openset/leetcode/tree/master/problems/check-if-word-is-valid-after-substitutions) | [[栈](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | | 966 | [元音拼写检查器](https://github.com/openset/leetcode/tree/master/problems/vowel-spellchecker) | [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Medium | -| 937 | [重新排列日志文件](https://github.com/openset/leetcode/tree/master/problems/reorder-log-files) | [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | +| 937 | [重新排列日志文件](https://github.com/openset/leetcode/tree/master/problems/reorder-data-in-log-files) | [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | | 936 | [戳印序列](https://github.com/openset/leetcode/tree/master/problems/stamping-the-sequence) | [[贪心算法](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Hard | | 929 | [独特的电子邮件地址](https://github.com/openset/leetcode/tree/master/problems/unique-email-addresses) | [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | | 925 | [长按键入](https://github.com/openset/leetcode/tree/master/problems/long-pressed-name) | [[双指针](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] [[字符串](https://github.com/openset/leetcode/tree/master/tag/string/README.md)] | Easy | diff --git a/tag/topological-sort/README.md b/tag/topological-sort/README.md index 0b115de95..1fd7cff97 100644 --- a/tag/topological-sort/README.md +++ b/tag/topological-sort/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1203 | [项目管理](https://github.com/openset/leetcode/tree/master/problems/sort-items-by-groups-respecting-dependencies) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] [[拓扑排序](https://github.com/openset/leetcode/tree/master/tag/topological-sort/README.md)] | Hard | | 444 | [序列重建](https://github.com/openset/leetcode/tree/master/problems/sequence-reconstruction) 🔒 | [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] [[拓扑排序](https://github.com/openset/leetcode/tree/master/tag/topological-sort/README.md)] | Medium | | 329 | [矩阵中的最长递增路径](https://github.com/openset/leetcode/tree/master/problems/longest-increasing-path-in-a-matrix) | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[拓扑排序](https://github.com/openset/leetcode/tree/master/tag/topological-sort/README.md)] [[记忆化](https://github.com/openset/leetcode/tree/master/tag/memoization/README.md)] | Hard | | 269 | [火星词典](https://github.com/openset/leetcode/tree/master/problems/alien-dictionary) 🔒 | [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] [[拓扑排序](https://github.com/openset/leetcode/tree/master/tag/topological-sort/README.md)] | Hard | diff --git a/tag/union-find/README.md b/tag/union-find/README.md index a39747a51..835928141 100644 --- a/tag/union-find/README.md +++ b/tag/union-find/README.md @@ -9,6 +9,7 @@ | # | 题名 | 标签 | 难度 | | :-: | - | - | :-: | +| 1202 | [交换字符串中的元素](https://github.com/openset/leetcode/tree/master/problems/smallest-string-with-swaps) | [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Medium | | 1168 | [水资源分配优化](https://github.com/openset/leetcode/tree/master/problems/optimize-water-distribution-in-a-village) 🔒 | [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Hard | | 1135 | [最低成本联通所有城市](https://github.com/openset/leetcode/tree/master/problems/connecting-cities-with-minimum-cost) 🔒 | [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Medium | | 1102 | [得分最高的路径](https://github.com/openset/leetcode/tree/master/problems/path-with-maximum-minimum-value) 🔒 | [[深度优先搜索](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)] [[并查集](https://github.com/openset/leetcode/tree/master/tag/union-find/README.md)] [[图](https://github.com/openset/leetcode/tree/master/tag/graph/README.md)] | Medium |