You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,12 @@ LeetCode Problems' Solutions
70
70
71
71
| # | Title | Solution | Difficulty |
72
72
| :-: | - | - | :-: |
73
+
| <spanid="1569">1569</span> |[Number of Ways to Reorder Array to Get Same BST](https://leetcode.com/problems/number-of-ways-to-reorder-array-to-get-same-bst"将子数组重新排序得到同一个二叉查找树的方案数")|[Go](problems/number-of-ways-to-reorder-array-to-get-same-bst)| Hard |
74
+
| <spanid="1568">1568</span> |[Minimum Number of Days to Disconnect Island](https://leetcode.com/problems/minimum-number-of-days-to-disconnect-island"使陆地分离的最少天数")|[Go](problems/minimum-number-of-days-to-disconnect-island)| Hard |
75
+
| <spanid="1567">1567</span> |[Maximum Length of Subarray With Positive Product](https://leetcode.com/problems/maximum-length-of-subarray-with-positive-product"乘积为正数的最长子数组长度")|[Go](problems/maximum-length-of-subarray-with-positive-product)| Medium |
76
+
| <spanid="1566">1566</span> |[Detect Pattern of Length M Repeated K or More Times](https://leetcode.com/problems/detect-pattern-of-length-m-repeated-k-or-more-times"重复至少 K 次且长度为 M 的模式")|[Go](problems/detect-pattern-of-length-m-repeated-k-or-more-times)| Easy |
77
+
| <spanid="1565">1565</span> |[Unique Orders and Customers Per Month](https://leetcode.com/problems/unique-orders-and-customers-per-month) 🔒 |[MySQL](problems/unique-orders-and-customers-per-month)| Easy |
78
+
| <spanid="1564">1564</span> |[Put Boxes Into the Warehouse I](https://leetcode.com/problems/put-boxes-into-the-warehouse-i) 🔒 |[Go](problems/put-boxes-into-the-warehouse-i)| Medium |
73
79
| <spanid="1563">1563</span> |[Stone Game V](https://leetcode.com/problems/stone-game-v"石子游戏 V")|[Go](problems/stone-game-v)| Hard |
74
80
| <spanid="1562">1562</span> |[Find Latest Group of Size M](https://leetcode.com/problems/find-latest-group-of-size-m"查找大小为 M 的最新分组")|[Go](problems/find-latest-group-of-size-m)| Medium |
75
81
| <spanid="1561">1561</span> |[Maximum Number of Coins You Can Get](https://leetcode.com/problems/maximum-number-of-coins-you-can-get"你可以获得的最大硬币数目")|[Go](problems/maximum-number-of-coins-you-can-get)| Medium |
@@ -78,8 +84,8 @@ LeetCode Problems' Solutions
78
84
| <spanid="1558">1558</span> |[Minimum Numbers of Function Calls to Make Target Array](https://leetcode.com/problems/minimum-numbers-of-function-calls-to-make-target-array"得到目标数组的最少函数调用次数")|[Go](problems/minimum-numbers-of-function-calls-to-make-target-array)| Medium |
79
85
| <spanid="1557">1557</span> |[Minimum Number of Vertices to Reach All Nodes](https://leetcode.com/problems/minimum-number-of-vertices-to-reach-all-nodes"可以到达所有点的最少点数目")|[Go](problems/minimum-number-of-vertices-to-reach-all-nodes)| Medium |
| <spanid="1555">1555</span> |[Bank Account Summary](https://leetcode.com/problems/bank-account-summary) 🔒 |[MySQL](problems/bank-account-summary)| Medium |
82
-
| <spanid="1554">1554</span> |[Strings Differ by One Character](https://leetcode.com/problems/strings-differ-by-one-character) 🔒 |[Go](problems/strings-differ-by-one-character)| Medium |
87
+
| <spanid="1555">1555</span> |[Bank Account Summary](https://leetcode.com/problems/bank-account-summary"银行账户概要") 🔒 |[MySQL](problems/bank-account-summary)| Medium |
88
+
| <spanid="1554">1554</span> |[Strings Differ by One Character](https://leetcode.com/problems/strings-differ-by-one-character"只有一个不同字符的字符串") 🔒 |[Go](problems/strings-differ-by-one-character)| Medium |
83
89
| <spanid="1553">1553</span> |[Minimum Number of Days to Eat N Oranges](https://leetcode.com/problems/minimum-number-of-days-to-eat-n-oranges"吃掉 N 个橘子的最少天数")|[Go](problems/minimum-number-of-days-to-eat-n-oranges)| Hard |
84
90
| <spanid="1552">1552</span> |[Magnetic Force Between Two Balls](https://leetcode.com/problems/magnetic-force-between-two-balls"两球之间的磁力")|[Go](problems/magnetic-force-between-two-balls)| Medium |
85
91
| <spanid="1551">1551</span> |[Minimum Operations to Make Array Equal](https://leetcode.com/problems/minimum-operations-to-make-array-equal"使数组中所有元素相等的最小操作数")|[Go](problems/minimum-operations-to-make-array-equal)| Medium |
| <spanid="1535">1535</span> |[Find the Winner of an Array Game](https://leetcode.com/problems/find-the-winner-of-an-array-game"找出数组游戏的赢家")|[Go](problems/find-the-winner-of-an-array-game)| Medium |
102
108
| <spanid="1534">1534</span> |[Count Good Triplets](https://leetcode.com/problems/count-good-triplets"统计好三元组")|[Go](problems/count-good-triplets)| Easy |
103
109
| <spanid="1533">1533</span> |[Find the Index of the Large Integer](https://leetcode.com/problems/find-the-index-of-the-large-integer) 🔒 |[Go](problems/find-the-index-of-the-large-integer)| Medium |
104
-
| <spanid="1532">1532</span> |[The Most Recent Three Orders](https://leetcode.com/problems/the-most-recent-three-orders) 🔒 |[MySQL](problems/the-most-recent-three-orders)| Medium |
110
+
| <spanid="1532">1532</span> |[The Most Recent Three Orders](https://leetcode.com/problems/the-most-recent-three-orders"最近的三笔订单") 🔒 |[MySQL](problems/the-most-recent-three-orders)| Medium |
105
111
| <spanid="1531">1531</span> |[String Compression II](https://leetcode.com/problems/string-compression-ii"压缩字符串 II")|[Go](problems/string-compression-ii)| Hard |
106
112
| <spanid="1530">1530</span> |[Number of Good Leaf Nodes Pairs](https://leetcode.com/problems/number-of-good-leaf-nodes-pairs"好叶子节点对的数量")|[Go](problems/number-of-good-leaf-nodes-pairs)| Medium |
107
113
| <spanid="1529">1529</span> |[Bulb Switcher IV](https://leetcode.com/problems/bulb-switcher-iv"灯泡开关 IV")|[Go](problems/bulb-switcher-iv)| Medium |
| <spanid="1527">1527</span> |[Patients With a Condition](https://leetcode.com/problems/patients-with-a-condition) 🔒 |[MySQL](problems/patients-with-a-condition)| Easy |
115
+
| <spanid="1527">1527</span> |[Patients With a Condition](https://leetcode.com/problems/patients-with-a-condition"患某种疾病的患者") 🔒 |[MySQL](problems/patients-with-a-condition)| Easy |
110
116
| <spanid="1526">1526</span> |[Minimum Number of Increments on Subarrays to Form a Target Array](https://leetcode.com/problems/minimum-number-of-increments-on-subarrays-to-form-a-target-array"形成目标数组的子数组最少增加次数")|[Go](problems/minimum-number-of-increments-on-subarrays-to-form-a-target-array)| Hard |
111
117
| <spanid="1525">1525</span> |[Number of Good Ways to Split a String](https://leetcode.com/problems/number-of-good-ways-to-split-a-string"字符串的好分割数目")|[Go](problems/number-of-good-ways-to-split-a-string)| Medium |
112
118
| <spanid="1524">1524</span> |[Number of Sub-arrays With Odd Sum](https://leetcode.com/problems/number-of-sub-arrays-with-odd-sum"和为奇数的子数组数目")|[Go](problems/number-of-sub-arrays-with-odd-sum)| Medium |
113
119
| <spanid="1523">1523</span> |[Count Odd Numbers in an Interval Range](https://leetcode.com/problems/count-odd-numbers-in-an-interval-range"在区间范围内统计奇数数目")|[Go](problems/count-odd-numbers-in-an-interval-range)| Easy |
114
-
| <spanid="1522">1522</span> |[Diameter of N-Ary Tree](https://leetcode.com/problems/diameter-of-n-ary-tree) 🔒 |[Go](problems/diameter-of-n-ary-tree)| Medium |
120
+
| <spanid="1522">1522</span> |[Diameter of N-Ary Tree](https://leetcode.com/problems/diameter-of-n-ary-tree"N 叉树的直径") 🔒 |[Go](problems/diameter-of-n-ary-tree)| Medium |
115
121
| <spanid="1521">1521</span> |[Find a Value of a Mysterious Function Closest to Target](https://leetcode.com/problems/find-a-value-of-a-mysterious-function-closest-to-target"找到最接近目标值的函数值")|[Go](problems/find-a-value-of-a-mysterious-function-closest-to-target)| Hard |
116
122
| <spanid="1520">1520</span> |[Maximum Number of Non-Overlapping Substrings](https://leetcode.com/problems/maximum-number-of-non-overlapping-substrings"最多的不重叠子字符串")|[Go](problems/maximum-number-of-non-overlapping-substrings)| Hard |
117
123
| <spanid="1519">1519</span> |[Number of Nodes in the Sub-Tree With the Same Label](https://leetcode.com/problems/number-of-nodes-in-the-sub-tree-with-the-same-label"子树中标签相同的节点数")|[Go](problems/number-of-nodes-in-the-sub-tree-with-the-same-label)| Medium |
Copy file name to clipboardExpand all lines: problems/check-if-word-is-valid-after-substitutions/README.md
+23-34Lines changed: 23 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,71 +11,60 @@
11
11
12
12
## [1003. Check If Word Is Valid After Substitutions (Medium)](https://leetcode.com/problems/check-if-word-is-valid-after-substitutions"检查替换后的词是否有效")
13
13
14
-
<p>We are given that the string <code>"abc"</code> is valid.</p>
14
+
<p>We can say that a string is valid if it follows one of the three following cases:</p>
15
15
16
-
<p>From any valid string <code>V</code>, we may split <code>V</code> into two pieces <code>X</code> and <code>Y</code> such that <code>X + Y</code> (<code>X</code> concatenated with <code>Y</code>) is equal to <code>V</code>.  (<code>X</code> or <code>Y</code> may be empty.)  Then, <code>X + "abc" + Y</code> is also valid.</p>
16
+
<ul>
17
+
<li>An empty string <code>""</code> is valid.</li>
18
+
<li>The string <code>"abc"</code> is also valid.</li>
19
+
<li>Any string in the form <code>"a" + str + "bc"</code>, <code>"ab" + str + "c"</code>, <code>str + "abc"</code> or <code>"abc" + str</code> where <code>str</code> is a valid string is also considered a valid string.</li>
20
+
</ul>
17
21
18
-
<p>If for example <code>S = "abc"</code>, then examples of valid strings are: <code>"abc", "aabcbc", "abcabc", "abcabcababcc"</code>.  Examples of <strong>invalid</strong> strings are: <code>"abccba"</code>,<code>"ab"</code>, <code>"cababc"</code>, <code>"bac"</code>.</p>
22
+
<p>For example, <code>""</code>, <code>"abc"</code>, <code>"aabcbc"</code>, <code>"abcabc"</code> and <code>"abcabcababcc"</code> are all <strong>valid</strong> strings, while <code>"abccba"</code>, <code>"ab"</code>, <code>"cababc"</code> and <code>"bac"</code> are <strong>not valid</strong> strings.</p>
19
23
20
-
<p>Return <code>true</code> if and only if the given string <code>S</code> is valid.</p>
24
+
<p>Given a string <code>s</code>, return <code>true</code> if it is a valid string, otherwise, return <code>false</code>.</p>
Then we can insert another "abc" between "a" and "bc", resulting in "a" + "abc" + "bc" which is "aabcbc".
<strong>Input:</strong> s = "abcabcababcc"
41
+
<strong>Output:</strong>true
40
42
<strong>Explanation: </strong>
41
43
"abcabcabc" is valid after consecutive insertings of "abc".
42
44
Then we can insert "abc" before the last letter, resulting in "abcabcab" + "abc" + "c" which is "abcabcababcc".
0 commit comments