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
|[Leetcode-3160](https://leetcode.com/problems/find-the-number-of-distinct-colors-among-the-balls/)| Find The Number Of Distinct Colors Among The Balls |[c++](./leetcode/3160.find-the-number-of-distinct-colors-among-the-balls.cpp), [python3](./leetcode/3160.find-the-number-of-distinct-colors-among-the-balls.py)| Simulation | O\(N\)| O\(N\)| - |
188
+
|[Leetcode-3066](https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-ii/)| Minimum Operations To Exceed Threshold Value II |[c++](./leetcode/3066.minimum-operations-to-exceed-threshold-value-ii.cpp), [python3](./leetcode/3066.minimum-operations-to-exceed-threshold-value-ii.py)| Simulation | O\(NlogN\)| O\(N\)| - |
188
189
|[Leetcode-1910](https://leetcode.com/problems/remove-all-occurrences-of-a-substring/)| Remove All Occurrences Of A Substring |[c++](./leetcode/1910.remove-all-occurrences-of-a-substring.cpp), [python3](./leetcode/1910.remove-all-occurrences-of-a-substring.py)| Simulation | O\(NM\)| O\(1\)| - |
|[Leetcode-863](https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/)| All Nodes Distance K In Binary Tree |[c++](./leetcode/863.all-nodes-distance-k-in-binary-tree.cpp), [python3](./leetcode/863.all-nodes-distance-k-in-binary-tree.py)| Hash Table | O\(N\)| O\(N\)| - |
|[Leetcode-126](https://leetcode.com/problems/word-ladder-ii/)| Word Ladder II |[c++](./leetcode/126.word-ladder-ii.cpp), [python3](./leetcode/126.word-ladder-ii.py)| Hash Table | O\(\(N\*L\)^C\)| O\(N\)| - |
499
+
|[Lintcode-3756](https://www.lintcode.com/problem/number-of-unique-flavors-remaining-after-sharing-k-candies/)| Number Of Unique Flavors Remaining After Sharing K Candies |[c++](./lintcode/3756.number-of-unique-flavors-remaining-after-sharing-k-candies.cpp), [python3](./lintcode/3756.number-of-unique-flavors-remaining-after-sharing-k-candies.py)| Hash Table | O\(N\)| O\(N\)| Leetcode-2107 |
|[Leetcode-787](https://leetcode.com/problems/cheapest-flights-within-k-stops/)| Cheapest Flights Within K Stops |[c++](./leetcode/787.cheapest-flights-within-k-stops.cpp), [python3](./leetcode/787.cheapest-flights-within-k-stops.py)| Heap | O\(ElogV\)| O\(E\+V\)| - |
566
568
|[Leetcode-2349](https://leetcode.com/problems/design-a-number-container-system/)| Design A Number Container System |[c++](./leetcode/2349.design-a-number-container-system.cpp), [python3](./leetcode/2349.design-a-number-container-system.py)| Heap | O\(LogN\)| O\(N\)| - |
|[Leetcode-1046](https://leetcode.com/problems/last-stone-weight/)| Last Stone Weight |[c++](./leetcode/1046.last-stone-weight.cpp), [python3](./leetcode/1046.last-stone-weight.py)| Heap | O\(NlogN\)| O\(N\)| - |
578
580
|[Leetcode-2342](https://leetcode.com/problems/max-sum-of-a-pair-with-equal-sum-of-digits/)| Max Sum Of A Pair With Equal Sum Of Digits |[c++](./leetcode/2342.max-sum-of-a-pair-with-equal-sum-of-digits.cpp), [python3](./leetcode/2342.max-sum-of-a-pair-with-equal-sum-of-digits.py)| Heap | O\(N\)| O\(N\)| - |
|[Leetcode-1514](https://leetcode.com/problems/path-with-maximum-probability/)| Path With Maximum Probability |[c++](./leetcode/1514.path-with-maximum-probability.cpp), [python3](./leetcode/1514.path-with-maximum-probability.py)| Heap | O\(VlogE\)| O\(V\+E\)| - |
|[Leetcode-632](https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists/)| Smallest Range Covering Elements From K Lists |[c++](./leetcode/632.smallest-range-covering-elements-from-k-lists.cpp), [python3](./leetcode/632.smallest-range-covering-elements-from-k-lists.py)| Sliding Window | O\(NlogN\)| O\(N\)| - |
660
+
|[Lintcode-3724](https://www.lintcode.com/problem/distinct-numbers-in-each-subarray/)| Distinct Numbers In Each Subarray |[c++](./lintcode/3724.distinct-numbers-in-each-subarray.cpp), [python3](./lintcode/3724.distinct-numbers-in-each-subarray.py)| Sliding Window | O\(N\)| O\(K\)| Leetcode-1852 |
661
+
|[Lintcode-3675](https://www.lintcode.com/problem/minimum-swaps-to-group-all-1s-together/)| Minimum Swaps To Group All 1S Together |[c++](./lintcode/3675.minimum-swaps-to-group-all-1s-together.cpp), [python3](./lintcode/3675.minimum-swaps-to-group-all-1s-together.py)| Sliding Window | O\(N\)| O\(1\)| Leetcode-1151 |
657
662
|[Lintcode-642](https://www.lintcode.com/problem/moving-average-from-data-stream/)| Moving Average From Data Stream |[c++](./lintcode/642.moving-average-from-data-stream.cpp), [python3](./lintcode/642.moving-average-from-data-stream.py)| Sliding Window | O\(1\)| O\(K\)| Leetcode-346 |
663
+
|[Lintcode-3756](https://www.lintcode.com/problem/number-of-unique-flavors-remaining-after-sharing-k-candies/)| Number Of Unique Flavors Remaining After Sharing K Candies |[c++](./lintcode/3756.number-of-unique-flavors-remaining-after-sharing-k-candies.cpp), [python3](./lintcode/3756.number-of-unique-flavors-remaining-after-sharing-k-candies.py)| Sliding Window | O\(N\)| O\(N\)| Leetcode-2107 |
// You are given a 0-indexed integer array nums, and an integer k.
9
+
// In one operation, you will:
10
+
//
11
+
// Take the two smallest integers x and y in nums.
12
+
// Remove x and y from nums.
13
+
// Add min(x, y) * 2 + max(x, y) anywhere in the array.
14
+
//
15
+
// Note that you can only apply the described operation if nums contains at least two elements.
16
+
// Return the minimum number of operations needed so that all elements of the array are greater than or equal to k.
17
+
//
18
+
// Example 1:
19
+
//
20
+
// Input: nums = [2,11,10,1,3], k = 10
21
+
// Output: 2
22
+
// Explanation: In the first operation, we remove elements 1 and 2, then add 1 * 2 + 2 to nums. nums becomes equal to [4, 11, 10, 3].
23
+
// In the second operation, we remove elements 3 and 4, then add 3 * 2 + 4 to nums. nums becomes equal to [10, 11, 10].
24
+
// At this stage, all the elements of nums are greater than or equal to 10 so we can stop.
25
+
// It can be shown that 2 is the minimum number of operations needed so that all elements of the array are greater than or equal to 10.
26
+
//
27
+
// Example 2:
28
+
//
29
+
// Input: nums = [1,1,2,4,9], k = 20
30
+
// Output: 4
31
+
// Explanation: After one operation, nums becomes equal to [2, 4, 9, 3].
32
+
// After two operations, nums becomes equal to [7, 4, 9].
33
+
// After three operations, nums becomes equal to [15, 9].
34
+
// After four operations, nums becomes equal to [33].
35
+
// At this stage, all the elements of nums are greater than 20 so we can stop.
36
+
// It can be shown that 4 is the minimum number of operations needed so that all elements of the array are greater than or equal to 20.
37
+
//
38
+
// Constraints:
39
+
//
40
+
// 2 <= nums.length <= 2 * 105
41
+
// 1 <= nums[i] <= 109
42
+
// 1 <= k <= 109
43
+
// The input is generated such that an answer always exists. That is, there exists some sequence of operations after which all elements of the array are greater than or equal to k.
# You are given a 0-indexed integer array nums, and an integer k.
9
+
# In one operation, you will:
10
+
#
11
+
# Take the two smallest integers x and y in nums.
12
+
# Remove x and y from nums.
13
+
# Add min(x, y) * 2 + max(x, y) anywhere in the array.
14
+
#
15
+
# Note that you can only apply the described operation if nums contains at least two elements.
16
+
# Return the minimum number of operations needed so that all elements of the array are greater than or equal to k.
17
+
#
18
+
# Example 1:
19
+
#
20
+
# Input: nums = [2,11,10,1,3], k = 10
21
+
# Output: 2
22
+
# Explanation: In the first operation, we remove elements 1 and 2, then add 1 * 2 + 2 to nums. nums becomes equal to [4, 11, 10, 3].
23
+
# In the second operation, we remove elements 3 and 4, then add 3 * 2 + 4 to nums. nums becomes equal to [10, 11, 10].
24
+
# At this stage, all the elements of nums are greater than or equal to 10 so we can stop.
25
+
# It can be shown that 2 is the minimum number of operations needed so that all elements of the array are greater than or equal to 10.
26
+
#
27
+
# Example 2:
28
+
#
29
+
# Input: nums = [1,1,2,4,9], k = 20
30
+
# Output: 4
31
+
# Explanation: After one operation, nums becomes equal to [2, 4, 9, 3].
32
+
# After two operations, nums becomes equal to [7, 4, 9].
33
+
# After three operations, nums becomes equal to [15, 9].
34
+
# After four operations, nums becomes equal to [33].
35
+
# At this stage, all the elements of nums are greater than 20 so we can stop.
36
+
# It can be shown that 4 is the minimum number of operations needed so that all elements of the array are greater than or equal to 20.
37
+
#
38
+
# Constraints:
39
+
#
40
+
# 2 <= nums.length <= 2 * 105
41
+
# 1 <= nums[i] <= 109
42
+
# 1 <= k <= 109
43
+
# The input is generated such that an answer always exists. That is, there exists some sequence of operations after which all elements of the array are greater than or equal to k.
0 commit comments