Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 565dd3b

Browse files
author
Shuo
authored
Merge pull request #814 from openset/develop
A: new
2 parents e4250e6 + 20ae929 commit 565dd3b

File tree

51 files changed

+1283
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1283
-291
lines changed

‎README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ LeetCode Problems' Solutions
7070

7171
| # | Title | Solution | Difficulty |
7272
| :-: | - | - | :-: |
73+
| <span id="1595">1595</span> | [Minimum Cost to Connect Two Groups of Points](https://leetcode.com/problems/minimum-cost-to-connect-two-groups-of-points "连通两组点的最小成本") | [Go](problems/minimum-cost-to-connect-two-groups-of-points) | Hard |
74+
| <span id="1594">1594</span> | [Maximum Non Negative Product in a Matrix](https://leetcode.com/problems/maximum-non-negative-product-in-a-matrix "矩阵的最大非负积") | [Go](problems/maximum-non-negative-product-in-a-matrix) | Medium |
75+
| <span id="1593">1593</span> | [Split a String Into the Max Number of Unique Substrings](https://leetcode.com/problems/split-a-string-into-the-max-number-of-unique-substrings "拆分字符串使唯一子字符串的数目最大") | [Go](problems/split-a-string-into-the-max-number-of-unique-substrings) | Medium |
76+
| <span id="1592">1592</span> | [Rearrange Spaces Between Words](https://leetcode.com/problems/rearrange-spaces-between-words "重新排列单词间的空格") | [Go](problems/rearrange-spaces-between-words) | Easy |
77+
| <span id="1591">1591</span> | [Strange Printer II](https://leetcode.com/problems/strange-printer-ii "奇怪的打印机 II") | [Go](problems/strange-printer-ii) | Hard |
78+
| <span id="1590">1590</span> | [Make Sum Divisible by P](https://leetcode.com/problems/make-sum-divisible-by-p "使数组和能被 P 整除") | [Go](problems/make-sum-divisible-by-p) | Medium |
79+
| <span id="1589">1589</span> | [Maximum Sum Obtained of Any Permutation](https://leetcode.com/problems/maximum-sum-obtained-of-any-permutation "所有排列中的最大和") | [Go](problems/maximum-sum-obtained-of-any-permutation) | Medium |
80+
| <span id="1588">1588</span> | [Sum of All Odd Length Subarrays](https://leetcode.com/problems/sum-of-all-odd-length-subarrays "所有奇数长度子数组的和") | [Go](problems/sum-of-all-odd-length-subarrays) | Easy |
81+
| <span id="1587">1587</span> | [Bank Account Summary II](https://leetcode.com/problems/bank-account-summary-ii) 🔒 | [MySQL](problems/bank-account-summary-ii) | Easy |
82+
| <span id="1586">1586</span> | [Binary Search Tree Iterator II](https://leetcode.com/problems/binary-search-tree-iterator-ii) 🔒 | [Go](problems/binary-search-tree-iterator-ii) | Medium |
7383
| <span id="1585">1585</span> | [Check If String Is Transformable With Substring Sort Operations](https://leetcode.com/problems/check-if-string-is-transformable-with-substring-sort-operations "检查字符串是否可以通过排序子字符串得到另一个字符串") | [Go](problems/check-if-string-is-transformable-with-substring-sort-operations) | Hard |
7484
| <span id="1584">1584</span> | [Min Cost to Connect All Points](https://leetcode.com/problems/min-cost-to-connect-all-points "连接所有点的最小费用") | [Go](problems/min-cost-to-connect-all-points) | Medium |
7585
| <span id="1583">1583</span> | [Count Unhappy Friends](https://leetcode.com/problems/count-unhappy-friends "统计不开心的朋友") | [Go](problems/count-unhappy-friends) | Medium |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../binary-search-tree-iterator-ii "Binary Search Tree Iterator II")
9+
10+
[Next >](../sum-of-all-odd-length-subarrays "Sum of All Odd Length Subarrays")
11+
12+
## [1587. Bank Account Summary II (Easy)](https://leetcode.com/problems/bank-account-summary-ii "")
13+
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Create table If Not Exists Users (account int, name varchar(20));
2+
Create table If Not Exists Transactions (trans_id int, account int, amount int, transacted_on date);
3+
Truncate table Users;
4+
insert into Users (account, name) values ('900001', 'Alice');
5+
insert into Users (account, name) values ('900002', 'Bob');
6+
insert into Users (account, name) values ('900003', 'Charlie');
7+
Truncate table Transactions;
8+
insert into Transactions (trans_id, account, amount, transacted_on) values ('1', '900001', '7000', '2020年08月01日');
9+
insert into Transactions (trans_id, account, amount, transacted_on) values ('2', '900001', '7000', '2020年09月01日');
10+
insert into Transactions (trans_id, account, amount, transacted_on) values ('3', '900001', '-3000', '2020年09月02日');
11+
insert into Transactions (trans_id, account, amount, transacted_on) values ('4', '900002', '1000', '2020年09月12日');
12+
insert into Transactions (trans_id, account, amount, transacted_on) values ('5', '900003', '6000', '2020年08月07日');
13+
insert into Transactions (trans_id, account, amount, transacted_on) values ('6', '900003', '6000', '2020年09月07日');
14+
insert into Transactions (trans_id, account, amount, transacted_on) values ('7', '900003', '-4000', '2020年09月11日');

‎problems/binary-number-with-alternating-bits/README.md

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,49 @@
1313

1414
<p>Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.</p>
1515

16-
<p><b>Example 1:</b><br />
16+
<p>&nbsp;</p>
17+
<p><strong>Example 1:</strong></p>
18+
1719
<pre>
18-
<b>Input:</b> 5
19-
<b>Output:</b> True
20-
<b>Explanation:</b>
21-
The binary representation of 5 is: 101
20+
<strong>Input:</strong> n = 5
21+
<strong>Output:</strong> true
22+
<strong>Explanation:</strong> The binary representation of 5 is: 101
2223
</pre>
23-
</p>
2424

25-
<p><b>Example 2:</b><br />
25+
<p><strong>Example 2:</strong></p>
26+
2627
<pre>
27-
<b>Input:</b> 7
28-
<b>Output:</b> False
29-
<b>Explanation:</b>
30-
The binary representation of 7 is: 111.
31-
</pre>
32-
</p>
28+
<strong>Input:</strong> n = 7
29+
<strong>Output:</strong> false
30+
<strong>Explanation:</strong> The binary representation of 7 is: 111.</pre>
31+
32+
<p><strong>Example 3:</strong></p>
3333

34-
<p><b>Example 3:</b><br />
3534
<pre>
36-
<b>Input:</b> 11
37-
<b>Output:</b> False
38-
<b>Explanation:</b>
39-
The binary representation of 11 is: 1011.
40-
</pre>
41-
</p>
35+
<strong>Input:</strong> n = 1
36+
<strong>Output:</strong> true
37+
<strong>Explanation:</strong> The binary representation of 11 is: 1011.</pre>
38+
39+
<p><strong>Example 4:</strong></p>
4240

43-
<p><b>Example 4:</b><br />
4441
<pre>
45-
<b>Input:</b> 10
46-
<b>Output:</b> True
47-
<b>Explanation:</b>
48-
The binary representation of 10 is: 1010.
42+
<strong>Input:</strong> n = 2
43+
<strong>Output:</strong> true
44+
<strong>Explanation:</strong> The binary representation of 10 is: 1010.</pre>
45+
46+
<p><strong>Example 5:</strong></p>
47+
48+
<pre>
49+
<strong>Input:</strong> n = 3
50+
<strong>Output:</strong> false
4951
</pre>
50-
</p>
52+
53+
<p>&nbsp;</p>
54+
<p><strong>Constraints:</strong></p>
55+
56+
<ul>
57+
<li><code>1 &lt;= n &lt;= 2<sup>31</sup> - 1</code></li>
58+
</ul>
5159

5260
### Related Topics
5361
[[Bit Manipulation](../../tag/bit-manipulation/README.md)]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../check-if-string-is-transformable-with-substring-sort-operations "Check If String Is Transformable With Substring Sort Operations")
9+
10+
[Next >](../bank-account-summary-ii "Bank Account Summary II")
11+
12+
## [1586. Binary Search Tree Iterator II (Medium)](https://leetcode.com/problems/binary-search-tree-iterator-ii "")
13+
14+
15+
16+
### Related Topics
17+
[[Design](../../tag/design/README.md)]
18+
19+
### Hints
20+
<details>
21+
<summary>Hint 1</summary>
22+
The inorder traversal of a BST gives us the elements in a sorted order.
23+
</details>
24+
25+
<details>
26+
<summary>Hint 2</summary>
27+
We can use a stack to simulate the inorder traversal of the BST.
28+
</details>
29+
30+
<details>
31+
<summary>Hint 3</summary>
32+
We can use another stack as a buffer to store numbers returned from calls to next and use this buffer whenever prev is called.
33+
</details>

‎problems/binary-tree-inorder-traversal/README.md

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,53 @@
1111

1212
## [94. Binary Tree Inorder Traversal (Medium)](https://leetcode.com/problems/binary-tree-inorder-traversal "二叉树的中序遍历")
1313

14-
<p>Given a binary tree, return the <em>inorder</em> traversal of its nodes&#39; values.</p>
14+
<p>Given the <code>root</code> of a binary tree, return <em>the inorder traversal of its nodes&#39; values</em>.</p>
1515

16-
<p><strong>Example:</strong></p>
16+
<p><strong>Follow up:</strong> Recursive solution is trivial, could you do it iteratively?</p>
1717

18+
<p>&nbsp;</p>
19+
<p><strong>Example 1:</strong></p>
20+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/15/inorder_1.jpg" style="width: 202px; height: 324px;" />
1821
<pre>
19-
<strong>Input:</strong> [1,null,2,3]
20-
1
21-
\
22-
2
23-
/
24-
3
22+
<strong>Input:</strong> root = [1,null,2,3]
23+
<strong>Output:</strong> [1,3,2]
24+
</pre>
2525

26-
<strong>Output:</strong> [1,3,2]</pre>
26+
<p><strong>Example 2:</strong></p>
2727

28-
<p><strong>Follow up:</strong> Recursive solution is trivial, could you do it iteratively?</p>
28+
<pre>
29+
<strong>Input:</strong> root = []
30+
<strong>Output:</strong> []
31+
</pre>
32+
33+
<p><strong>Example 3:</strong></p>
34+
35+
<pre>
36+
<strong>Input:</strong> root = [1]
37+
<strong>Output:</strong> [1]
38+
</pre>
39+
40+
<p><strong>Example 4:</strong></p>
41+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/15/inorder_5.jpg" style="width: 202px; height: 202px;" />
42+
<pre>
43+
<strong>Input:</strong> root = [1,2]
44+
<strong>Output:</strong> [2,1]
45+
</pre>
46+
47+
<p><strong>Example 5:</strong></p>
48+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/15/inorder_4.jpg" style="width: 202px; height: 202px;" />
49+
<pre>
50+
<strong>Input:</strong> root = [1,null,2]
51+
<strong>Output:</strong> [1,2]
52+
</pre>
53+
54+
<p>&nbsp;</p>
55+
<p><strong>Constraints:</strong></p>
56+
57+
<ul>
58+
<li>The number of nodes in the tree is in the range <code>[0, 100]</code>.</li>
59+
<li><code>-100 &lt;= Node.val &lt;= 100</code></li>
60+
</ul>
2961

3062
### Related Topics
3163
[[Stack](../../tag/stack/README.md)]

‎problems/bulls-and-cows/README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,66 @@
99

1010
[Next >](../longest-increasing-subsequence "Longest Increasing Subsequence")
1111

12-
## [299. Bulls and Cows (Easy)](https://leetcode.com/problems/bulls-and-cows "猜数字游戏")
12+
## [299. Bulls and Cows (Medium)](https://leetcode.com/problems/bulls-and-cows "猜数字游戏")
1313

14-
<p>You are playing the following <a href="https://en.wikipedia.org/wiki/Bulls_and_Cows" target="_blank">Bulls and Cows</a> game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in both digit and position (called &quot;bulls&quot;) and how many digits match the secret number but locate in the wrong position (called &quot;cows&quot;). Your friend will use successive guesses and hints to eventually derive the secret number.</p>
14+
<p>You are playing the <strong><a href="https://en.wikipedia.org/wiki/Bulls_and_Cows" target="_blank">Bulls and Cows</a></strong> game with your friend.</p>
1515

16-
<p>Write a function to return a hint according to the secret number and friend&#39;s guess, use <code>A</code> to indicate the bulls and <code>B</code> to indicate the cows.&nbsp;</p>
16+
<p>You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:</p>
1717

18-
<p>Please note that both secret number and friend&#39;s guess may contain duplicate digits.</p>
18+
<ul>
19+
<li>The number of &quot;bulls&quot;, which are digits in the guess that are in the correct position.</li>
20+
<li>The number of &quot;cows&quot;, which are digits in the guess that are in your secret number but are located in the wrong position. Specifically, the non-bull digits in the guess that could be rearranged such that they become bulls.</li>
21+
</ul>
1922

23+
<p>Given the secret number <code>secret</code> and your friend&#39;s guess <code>guess</code>, return <em>the hint for your friend&#39;s guess</em>.</p>
24+
25+
<p>The hint should be formatted as <code>&quot;xAyB&quot;</code>, where <code>x</code> is the number of bulls and <code>y</code> is the number of cows. Note that both <code>secret</code> and <code>guess</code> may contain duplicate digits.</p>
26+
27+
<p>&nbsp;</p>
2028
<p><strong>Example 1:</strong></p>
2129

2230
<pre>
2331
<strong>Input:</strong> secret = &quot;1807&quot;, guess = &quot;7810&quot;
24-
2532
<strong>Output:</strong> &quot;1A3B&quot;
26-
27-
<strong>Explanation:</strong> <code>1</code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;"> bull and </span><code>3</code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;"> cows. The bull is </span><code>8</code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;">, the cows are </span><code>0</code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;">, </span><code>1</code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;"> and </span><code>7<font face="sans-serif, Arial, Verdana, Trebuchet MS">.</font></code></pre>
33+
<strong>Explanation:</strong> Bulls are connected with a &#39;|&#39; and cows are underlined:
34+
&quot;1807&quot;
35+
|
36+
&quot;<u>7</u>8<u>10</u>&quot;</pre>
2837

2938
<p><strong>Example 2:</strong></p>
3039

3140
<pre>
3241
<strong>Input:</strong> secret = &quot;1123&quot;, guess = &quot;0111&quot;
33-
3442
<strong>Output:</strong> &quot;1A1B&quot;
43+
<strong>Explanation:</strong> Bulls are connected with a &#39;|&#39; and cows are underlined:
44+
&quot;1123&quot; &quot;1123&quot;
45+
| or |
46+
&quot;01<u>1</u>1&quot; &quot;011<u>1</u>&quot;
47+
Note that only one of the two unmatched 1s is counted as a cow since the non-bull digits can only be rearranged to allow one 1 to be a bull.
48+
</pre>
49+
50+
<p><strong>Example 3:</strong></p>
51+
52+
<pre>
53+
<strong>Input:</strong> secret = &quot;1&quot;, guess = &quot;0&quot;
54+
<strong>Output:</strong> &quot;0A0B&quot;
55+
</pre>
56+
57+
<p><strong>Example 4:</strong></p>
58+
59+
<pre>
60+
<strong>Input:</strong> secret = &quot;1&quot;, guess = &quot;1&quot;
61+
<strong>Output:</strong> &quot;1A0B&quot;
62+
</pre>
3563

36-
<strong>Explanation: </strong>The 1st <code>1 </code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;">in friend&#39;s guess is a bull, the 2nd or 3rd </span><code>1</code><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;"> is a cow</span><span style="font-family: sans-serif, Arial, Verdana, &quot;Trebuchet MS&quot;;">.</span></pre>
64+
<p>&nbsp;</p>
65+
<p><strong>Constraints:</strong></p>
3766

38-
<p><strong>Note: </strong>You may assume that the secret number and your friend&#39;s guess only contain digits, and their lengths are always equal.</p>
67+
<ul>
68+
<li><code>1 &lt;= secret.length, guess.length &lt;= 1000</code></li>
69+
<li><code>secret.length == guess.length</code></li>
70+
<li><code>secret</code> and <code>guess</code> consist of digits only.</li>
71+
</ul>
3972

4073
### Related Topics
4174
[[Hash Table](../../tag/hash-table/README.md)]

‎problems/check-if-string-is-transformable-with-substring-sort-operations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[< Previous](../min-cost-to-connect-all-points "Min Cost to Connect All Points")
99

10-
Next >
10+
[Next >](../binary-search-tree-iterator-ii"Binary Search Tree Iterator II")
1111

1212
## [1585. Check If String Is Transformable With Substring Sort Operations (Hard)](https://leetcode.com/problems/check-if-string-is-transformable-with-substring-sort-operations "检查字符串是否可以通过排序子字符串得到另一个字符串")
1313

‎problems/check-if-word-is-valid-after-substitutions/README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,58 @@
1111

1212
## [1003. Check If Word Is Valid After Substitutions (Medium)](https://leetcode.com/problems/check-if-word-is-valid-after-substitutions "检查替换后的词是否有效")
1313

14-
<p>We can say that a string is valid if it follows one of the three following cases:</p>
14+
<p>Given a string <code>s</code>, determine if it is <strong>valid</strong>.</p>
15+
16+
<p>A string <code>s</code> is <strong>valid</strong> if, starting with an empty string <code>t = &quot;&quot;</code>, you can <strong>transform </strong><code>t</code><strong> into </strong><code>s</code> after performing the following operation <strong>any number of times</strong>:</p>
1517

1618
<ul>
17-
<li>An empty string <code>&quot;&quot;</code> is valid.</li>
18-
<li>The string <code>&quot;abc&quot;</code> is also valid.</li>
19-
<li>Any string in the form <code>&quot;a&quot; + str + &quot;bc&quot;</code>, <code>&quot;ab&quot; + str + &quot;c&quot;</code>, <code>str + &quot;abc&quot;</code> or <code>&quot;abc&quot; + str</code> where <code>str</code> is a valid string is also considered a valid string.</li>
19+
<li>Insert string <code>&quot;abc&quot;</code> into any position in <code>t</code>. More formally, <code>t</code> becomes <code>t<sub>left</sub> + &quot;abc&quot; + t<sub>right</sub></code>, where <code>t == t<sub>left</sub> + t<sub>right</sub></code>. Note that <code>t<sub>left</sub></code> and <code>t<sub>right</sub></code> may be <strong>empty</strong>.</li>
2020
</ul>
2121

22-
<p>For example, <code>&quot;&quot;</code>, <code>&quot;abc&quot;</code>,&nbsp;<code>&quot;aabcbc&quot;</code>,&nbsp;<code>&quot;abcabc&quot;</code> and&nbsp;<code>&quot;abcabcababcc&quot;</code>&nbsp;are all <strong>valid</strong> strings, while&nbsp;<code>&quot;abccba&quot;</code>,&nbsp;<code>&quot;ab&quot;</code>, <code>&quot;cababc&quot;</code> and&nbsp;<code>&quot;bac&quot;</code>&nbsp;are <strong>not valid</strong> strings.</p>
23-
24-
<p>Given a string <code>s</code>, return <code>true</code> if it is a valid string, otherwise, return <code>false</code>.</p>
22+
<p>Return <code>true</code> <em>if </em><code>s</code><em> is a <strong>valid</strong> string, otherwise, return</em> <code>false</code>.</p>
2523

2624
<p>&nbsp;</p>
2725
<p><strong>Example 1:</strong></p>
2826

2927
<pre>
3028
<strong>Input:</strong> s = &quot;aabcbc&quot;
3129
<strong>Output:</strong> true
32-
<strong>Explanation: </strong>
33-
We start with the valid string &quot;abc&quot;.
34-
Then we can insert another &quot;abc&quot; between &quot;a&quot; and &quot;bc&quot;, resulting in &quot;a&quot; + &quot;abc&quot; + &quot;bc&quot; which is &quot;aabcbc&quot;.
35-
</pre>
30+
<strong>Explanation:</strong>
31+
&quot;&quot; -&gt; &quot;<u>abc</u>&quot; -&gt; &quot;a<u>abc</u>bc&quot;
32+
Thus, &quot;aabcbc&quot; is valid.</pre>
3633

3734
<p><strong>Example 2:</strong></p>
3835

3936
<pre>
4037
<strong>Input:</strong> s = &quot;abcabcababcc&quot;
4138
<strong>Output:</strong> true
42-
<strong>Explanation:</strong>
43-
&quot;abcabcabc&quot; is valid after consecutive insertings of &quot;abc&quot;.
44-
Then we can insert &quot;abc&quot; before the last letter, resulting in &quot;abcabcab&quot; + &quot;abc&quot; + &quot;c&quot; which is &quot;abcabcababcc&quot;.
39+
<strong>Explanation:</strong>
40+
&quot;&quot; -&gt;&quot;<u>abc</u>&quot; -&gt;&quot;abc<u>abc</u>&quot; -&gt;&quot;abcabc<u>abc</u>&quot; -&gt;&quot;abcabcab<u>abc</u>c&quot;
41+
Thus, &quot;abcabcababcc&quot; is valid.
4542
</pre>
4643

4744
<p><strong>Example 3:</strong></p>
4845

4946
<pre>
5047
<strong>Input:</strong> s = &quot;abccba&quot;
5148
<strong>Output:</strong> false
49+
<strong>Explanation:</strong> It is impossible to get &quot;abccba&quot; using the operation.
5250
</pre>
5351

5452
<p><strong>Example 4:</strong></p>
5553

5654
<pre>
5755
<strong>Input:</strong> s = &quot;cababc&quot;
5856
<strong>Output:</strong> false
57+
<strong>Explanation:</strong> It is impossible to get &quot;cababc&quot; using the operation.
5958
</pre>
6059

6160
<p>&nbsp;</p>
6261
<p><strong>Constraints:</strong></p>
6362

6463
<ul>
6564
<li><code>1 &lt;= s.length &lt;= 2 * 10<sup>4</sup></code></li>
66-
<li><code>s[i]</code> is <code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, or <code>&#39;c&#39;</code></li>
65+
<li><code>s</code> consists of letters <code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, and <code>&#39;c&#39;</code></li>
6766
</ul>
6867

6968
### Related Topics

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /