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-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,16 @@ LeetCode Problems' Solutions
62
62
63
63
| # | Title | Solution | Difficulty |
64
64
| :-: | - | - | :-: |
65
+
| <spanid="1250">1250</span> |[Check If It Is a Good Array](https://leetcode.com/problems/check-if-it-is-a-good-array"检查「好数组」")|[Go](https://github.com/openset/leetcode/tree/master/problems/check-if-it-is-a-good-array)| Hard |
66
+
| <spanid="1249">1249</span> |[Minimum Remove to Make Valid Parentheses](https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses"移除无效的括号")|[Go](https://github.com/openset/leetcode/tree/master/problems/minimum-remove-to-make-valid-parentheses)| Medium |
67
+
| <spanid="1248">1248</span> |[Count Number of Nice Subarrays](https://leetcode.com/problems/count-number-of-nice-subarrays"统计「优美子数组」")|[Go](https://github.com/openset/leetcode/tree/master/problems/count-number-of-nice-subarrays)| Medium |
68
+
| <spanid="1247">1247</span> |[Minimum Swaps to Make Strings Equal](https://leetcode.com/problems/minimum-swaps-to-make-strings-equal"交换字符使得字符串相同")|[Go](https://github.com/openset/leetcode/tree/master/problems/minimum-swaps-to-make-strings-equal)| Medium |
69
+
| <spanid="1246">1246</span> |[Palindrome Removal](https://leetcode.com/problems/palindrome-removal"删除回文子数组") 🔒 |[Go](https://github.com/openset/leetcode/tree/master/problems/palindrome-removal)| Hard |
70
+
| <spanid="1245">1245</span> |[Tree Diameter](https://leetcode.com/problems/tree-diameter"树的直径") 🔒 |[Go](https://github.com/openset/leetcode/tree/master/problems/tree-diameter)| Medium |
71
+
| <spanid="1244">1244</span> |[Design A Leaderboard](https://leetcode.com/problems/design-a-leaderboard"力扣排行榜") 🔒 |[Go](https://github.com/openset/leetcode/tree/master/problems/design-a-leaderboard)| Medium |
| <spanid="1242">1242</span> |[Web Crawler Multithreaded](https://leetcode.com/problems/web-crawler-multithreaded) 🔒 |[Go](https://github.com/openset/leetcode/tree/master/problems/web-crawler-multithreaded)| Medium |
74
+
| <spanid="1241">1241</span> |[Number of Comments per Post](https://leetcode.com/problems/number-of-comments-per-post"每个帖子的评论数") 🔒 |[MySQL](https://github.com/openset/leetcode/tree/master/problems/number-of-comments-per-post)| Easy |
65
75
| <spanid="1240">1240</span> |[Tiling a Rectangle with the Fewest Squares](https://leetcode.com/problems/tiling-a-rectangle-with-the-fewest-squares"铺瓷砖")|[Go](https://github.com/openset/leetcode/tree/master/problems/tiling-a-rectangle-with-the-fewest-squares)| Hard |
66
76
| <spanid="1239">1239</span> |[Maximum Length of a Concatenated String with Unique Characters](https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters"串联字符串的最大长度")|[Go](https://github.com/openset/leetcode/tree/master/problems/maximum-length-of-a-concatenated-string-with-unique-characters)| Medium |
67
77
| <spanid="1238">1238</span> |[Circular Permutation in Binary Representation](https://leetcode.com/problems/circular-permutation-in-binary-representation"循环码排列")|[Go](https://github.com/openset/leetcode/tree/master/problems/circular-permutation-in-binary-representation)| Medium |
@@ -154,7 +164,7 @@ LeetCode Problems' Solutions
154
164
| <spanid="1151">1151</span> |[Minimum Swaps to Group All 1's Together](https://leetcode.com/problems/minimum-swaps-to-group-all-1s-together"最少交换次数来组合所有的 1") 🔒 |[Go](https://github.com/openset/leetcode/tree/master/problems/minimum-swaps-to-group-all-1s-together)| Medium |
155
165
| <spanid="1150">1150</span> |[Check If a Number Is Majority Element in a Sorted Array](https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array"检查一个数是否在数组中占绝大多数") 🔒 |[Go](https://github.com/openset/leetcode/tree/master/problems/check-if-a-number-is-majority-element-in-a-sorted-array)| Easy |
156
166
| <spanid="1149">1149</span> |[Article Views II](https://leetcode.com/problems/article-views-ii) 🔒 |[MySQL](https://github.com/openset/leetcode/tree/master/problems/article-views-ii)| Medium |
| <spanid="1147">1147</span> |[Longest Chunked Palindrome Decomposition](https://leetcode.com/problems/longest-chunked-palindrome-decomposition"段式回文")|[Go](https://github.com/openset/leetcode/tree/master/problems/longest-chunked-palindrome-decomposition)| Hard |
159
169
| <spanid="1146">1146</span> |[Snapshot Array](https://leetcode.com/problems/snapshot-array"快照数组")|[Go](https://github.com/openset/leetcode/tree/master/problems/snapshot-array)| Medium |
160
170
| <spanid="1145">1145</span> |[Binary Tree Coloring Game](https://leetcode.com/problems/binary-tree-coloring-game"二叉树着色游戏")|[Go](https://github.com/openset/leetcode/tree/master/problems/binary-tree-coloring-game)| Medium |
[< Previous](https://github.com/openset/leetcode/tree/master/problems/minimum-remove-to-make-valid-parentheses"Minimum Remove to Make Valid Parentheses")
9
+
10
+
Next >
11
+
12
+
## [1250. Check If It Is a Good Array (Hard)](https://leetcode.com/problems/check-if-it-is-a-good-array"检查「好数组」")
13
+
14
+
<p>Given an array <code>nums</code> of positive integers. Your task is to select some subset of <code>nums</code>, multiply each element by an integer and add all these numbers. The array is said to be <strong>good </strong>if you can obtain a sum of <code>1</code> from the array by any possible subset and multiplicand.</p>
15
+
16
+
<p>Return <code>True</code> if the array is <strong>good </strong>otherwise return <code>False</code>.</p>
17
+
18
+
<p> </p>
19
+
<p><strong>Example 1:</strong></p>
20
+
21
+
<pre>
22
+
<strong>Input:</strong> nums = [12,5,7,23]
23
+
<strong>Output:</strong> true
24
+
<strong>Explanation:</strong> Pick numbers 5 and 7.
25
+
5*3 + 7*(-2) = 1
26
+
</pre>
27
+
28
+
<p><strong>Example 2:</strong></p>
29
+
30
+
<pre>
31
+
<strong>Input:</strong> nums = [29,6,10]
32
+
<strong>Output:</strong> true
33
+
<strong>Explanation:</strong> Pick numbers 29, 6 and 10.
[< Previous](https://github.com/openset/leetcode/tree/master/problems/minimum-swaps-to-make-strings-equal"Minimum Swaps to Make Strings Equal")
9
+
10
+
[Next >](https://github.com/openset/leetcode/tree/master/problems/minimum-remove-to-make-valid-parentheses"Minimum Remove to Make Valid Parentheses")
11
+
12
+
## [1248. Count Number of Nice Subarrays (Medium)](https://leetcode.com/problems/count-number-of-nice-subarrays"统计「优美子数组」")
13
+
14
+
<p>Given an array of integers <code>nums</code> and an integer <code>k</code>. A<em> </em>subarray is called <strong>nice</strong> if there are <code>k</code> odd numbers on it.</p>
15
+
16
+
<p>Return the number of <strong>nice</strong> sub-arrays.</p>
17
+
18
+
<p> </p>
19
+
<p><strong>Example 1:</strong></p>
20
+
21
+
<pre>
22
+
<strong>Input:</strong> nums = [1,1,2,1,1], k = 3
23
+
<strong>Output:</strong> 2
24
+
<strong>Explanation:</strong> The only sub-arrays with 3 odd numbers are [1,1,2,1] and [1,2,1,1].
25
+
</pre>
26
+
27
+
<p><strong>Example 2:</strong></p>
28
+
29
+
<pre>
30
+
<strong>Input:</strong> nums = [2,4,6], k = 1
31
+
<strong>Output:</strong> 0
32
+
<strong>Explanation:</strong> There is no odd numbers in the array.
33
+
</pre>
34
+
35
+
<p><strong>Example 3:</strong></p>
36
+
37
+
<pre>
38
+
<strong>Input:</strong> nums = [2,2,2,1,2,2,1,2,2,2], k = 2
Copy file name to clipboardExpand all lines: problems/design-linked-list/README.md
+19-9Lines changed: 19 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,26 @@
16
16
<p>Implement these functions in your linked list class:</p>
17
17
18
18
<ul>
19
-
<li>get(index) : Get the value of the <code>index</code>-th node in the linked list. If the index is invalid, return <code>-1</code>.</li>
20
-
<li>addAtHead(val) : Add a node of value <code>val</code> before the first element of the linked list. After the insertion, the new node will be the first node of the linked list.</li>
21
-
<li>addAtTail(val) : Append a node of value <code>val</code> to the last element of the linked list.</li>
22
-
<li>addAtIndex(index, val) : Add a node of value <code>val</code> before the <code>index</code>-th node in the linked list. If <code>index</code> equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted. If index is negative, the node will be inserted at the head of the list.</li>
23
-
<li>deleteAtIndex(index) : Delete the <code>index</code>-th node in the linked list, if the index is valid.</li>
19
+
<li><code>get(index)</code> : Get the value of the <code>index</code>-th node in the linked list. If the index is invalid, return <code>-1</code>.</li>
20
+
<li><code>addAtHead(val)</code> : Add a node of value <code>val</code> before the first element of the linked list. After the insertion, the new node will be the first node of the linked list.</li>
21
+
<li><code>addAtTail(val)</code> : Append a node of value <code>val</code> to the last element of the linked list.</li>
22
+
<li><code>addAtIndex(index, val)</code> : Add a node of value <code>val</code> before the <code>index</code>-th node in the linked list. If <code>index</code> equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted.</li>
23
+
<li><code>deleteAtIndex(index)</code> : Delete the <code>index</code>-th node in the linked list, if the index is valid.</li>
<li>Please do not use the built-in LinkedList library.</li>
53
+
<li>At most <code>2000</code> calls will be made to <code>get</code>, <code>addAtHead</code>, <code>addAtTail</code>, <code>addAtIndex</code> and <code>deleteAtIndex</code>.</li>
0 commit comments