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-973](https://leetcode.com/problems/k-closest-points-to-origin/)| K Closest Points To Origin |[c++](./leetcode/973.k-closest-points-to-origin.cpp), [python3](./leetcode/973.k-closest-points-to-origin.py)| Math | O\(NlogN\)| O\(K\)| - |
127
128
|[Leetcode-149](https://leetcode.com/problems/max-points-on-a-line/)| Max Points On A Line |[c++](./leetcode/149.max-points-on-a-line.cpp), [python3](./leetcode/149.max-points-on-a-line.py)| Math | O\(N^2\)| O\(N\)| - |
128
129
|[Leetcode-462](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/)| Minimum Moves To Equal Array Elements II |[c++](./leetcode/462.minimum-moves-to-equal-array-elements-ii.cpp), [python3](./leetcode/462.minimum-moves-to-equal-array-elements-ii.py)| Math | O\(NlogN\)| O\(1\)| - |
|[Leetcode-326](https://leetcode.com/problems/power-of-three/)| Power Of Three |[c++](./leetcode/326.power-of-three.cpp), [python3](./leetcode/326.power-of-three.py)| Math | O\(1\)| O\(1\)| - |
130
132
|[Leetcode-50](https://leetcode.com/problems/powx-n/)| Powx N |[c++](./leetcode/50.powx-n.cpp), [python3](./leetcode/50.powx-n.py)| Math | O\(logN\)| O\(1\)| - |
131
133
|[Leetcode-1352](https://leetcode.com/problems/product-of-the-last-k-numbers/)| Product Of The Last K Numbers |[c++](./leetcode/1352.product-of-the-last-k-numbers.cpp), [python3](./leetcode/1352.product-of-the-last-k-numbers.py)| Math | O\(1\)| O\(N\)| - |
|[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\)| - |
200
202
|[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\)| - |
|[Leetcode-2161](https://leetcode.com/problems/partition-array-according-to-given-pivot/)| Partition Array According To Given Pivot |[c++](./leetcode/2161.partition-array-according-to-given-pivot.cpp), [python3](./leetcode/2161.partition-array-according-to-given-pivot.py)| Simulation | O\(N\)| O\(N\)| - |
202
205
|[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-2](https://leetcode.com/problems/add-two-numbers/)| Add Two Numbers |[c++](./leetcode/2.add-two-numbers.cpp), [python3](./leetcode/2.add-two-numbers.py)| Linked List | O\(N \+ M\)| O\(1\)| - |
446
450
|[Leetcode-432](https://leetcode.com/problems/all-oone-data-structure/)| All Oone Data Structure |[c++](./leetcode/432.all-oone-data-structure.cpp), [python3](./leetcode/432.all-oone-data-structure.py)| Linked List | O\(1\)| O\(N\)| - |
447
451
|[Leetcode-109](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/)| Convert Sorted List To Binary Search Tree |[c++](./leetcode/109.convert-sorted-list-to-binary-search-tree.cpp), [python3](./leetcode/109.convert-sorted-list-to-binary-search-tree.py)| Linked List | O\(NlogN\)| O\(logN\)| - |
448
452
|[Leetcode-114](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)| Flatten Binary Tree To Linked List |[c++](./leetcode/114.flatten-binary-tree-to-linked-list.cpp), [python3](./leetcode/114.flatten-binary-tree-to-linked-list.py)| Linked List | O\(N\)| O\(H\)| - |
|[Leetcode-16](https://leetcode.com/problems/3sum-closest/)| 3Sum Closest |[c++](./leetcode/16.3sum-closest.cpp), [python3](./leetcode/16.3sum-closest.py)| Other |\-|\-| - |
1190
1194
|[Leetcode-454](https://leetcode.com/problems/4sum-ii/)| 4Sum II |[c++](./leetcode/454.4sum-ii.cpp)| Other |\-|\-| - |
1191
-
|[Leetcode-2](https://leetcode.com/problems/add-two-numbers/)| Add Two Numbers |[c++](./leetcode/2.add-two-numbers.cpp), [python3](./leetcode/2.add-two-numbers.py)| Other |\-|\-| - |
1192
1195
|[Leetcode-269](https://leetcode.com/problems/alien-dictionary/)| Alien Dictionary |[python3](./leetcode/269.alien-dictionary.py)| Other |\-|\-| - |
1193
1196
|[Leetcode-561](https://leetcode.com/problems/array-partition-i/)| Array Partition I |[c++](./leetcode/561.array-partition-i.cpp)| Other |\-|\-| - |
1194
1197
|[Leetcode-844](https://leetcode.com/problems/backspace-string-compare/)| Backspace String Compare |[c++](./leetcode/844.backspace-string-compare.cpp), [python3](./leetcode/844.backspace-string-compare.py)| Other |\-|\-| - |
|[Leetcode-599](https://leetcode.com/problems/minimum-index-sum-of-two-lists/)| Minimum Index Sum Of Two Lists |[c++](./leetcode/599.minimum-index-sum-of-two-lists.cpp)| Other |\-|\-| - |
1244
1247
|[Leetcode-283](https://leetcode.com/problems/move-zeroes/)| Move Zeroes |[c++](./leetcode/283.move-zeroes.cpp), [python3](./leetcode/283.move-zeroes.py)| Other |\-|\-| - |
1245
1248
|[Leetcode-346](https://leetcode.com/problems/moving-average-from-data-stream/)| Moving Average From Data Stream |[c++](./leetcode/346.moving-average-from-data-stream.cpp), [python3](./leetcode/346.moving-average-from-data-stream.py)| Other |\-|\-| - |
1246
-
|[Leetcode-43](https://leetcode.com/problems/multiply-strings/)| Multiply Strings |[c++](./leetcode/43.multiply-strings.cpp), [python3](./leetcode/43.multiply-strings.py)| Other |\-|\-| - |
1247
1249
|[Leetcode-31](https://leetcode.com/problems/next-permutation/)| Next Permutation |[c++](./leetcode/31.next-permutation.cpp), [python3](./leetcode/31.next-permutation.py)| Other |\-|\-| - |
1248
1250
|[Leetcode-447](https://leetcode.com/problems/number-of-boomerangs/)| Number Of Boomerangs |[c++](./leetcode/447.number-of-boomerangs.cpp), [python3](./leetcode/447.number-of-boomerangs.py)| Other |\-|\-| - |
1249
1251
|[Leetcode-323](https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/)| Number Of Connected Components In An Undirected Graph |[c++](./leetcode/323.number-of-connected-components-in-an-undirected-graph.cpp), [python3](./leetcode/323.number-of-connected-components-in-an-undirected-graph.py)| Other |\-|\-| - |
* You are given two non-empty linked lists representing two non-negative
15
-
* integers. The digits are stored in reverse order and each of their nodes
16
-
* contain a single digit. Add the two numbers and return it as a linked list.
17
-
*
18
-
* You may assume the two numbers do not contain any leading zero, except the
19
-
* number 0 itself.
20
-
*
21
-
* Example:
22
-
*
23
-
*
24
-
* Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
25
-
* Output: 7 -> 0 -> 8
26
-
* Explanation: 342 + 465 = 807.
27
-
*
28
-
*
29
-
*/
1
+
// Tag: Linked List, Math, Recursion
2
+
// Time: O(N + M)
3
+
// Space: O(1)
4
+
// Ref: -
5
+
// Note: -
6
+
7
+
// You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
8
+
// You may assume the two numbers do not contain any leading zero, except the number 0 itself.
9
+
//
10
+
// Example 1:
11
+
//
12
+
//
13
+
// Input: l1 = [2,4,3], l2 = [5,6,4]
14
+
// Output: [7,0,8]
15
+
// Explanation: 342 + 465 = 807.
16
+
//
17
+
// Example 2:
18
+
//
19
+
// Input: l1 = [0], l2 = [0]
20
+
// Output: [0]
21
+
//
22
+
// Example 3:
23
+
//
24
+
// Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
25
+
// Output: [8,9,9,9,0,0,0,1]
26
+
//
27
+
//
28
+
// Constraints:
29
+
//
30
+
// The number of nodes in each linked list is in the range [1, 100].
31
+
// 0 <= Node.val <= 9
32
+
// It is guaranteed that the list represents a number that does not have leading zeros.
# You are given two non-empty linked lists representing two non-negative
15
-
# integers. The digits are stored in reverse order and each of their nodes
16
-
# contain a single digit. Add the two numbers and return it as a linked list.
17
-
#
18
-
# You may assume the two numbers do not contain any leading zero, except the
19
-
# number 0 itself.
20
-
#
21
-
# Example:
22
-
#
23
-
#
24
-
# Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
25
-
# Output: 7 -> 0 -> 8
26
-
# Explanation: 342 + 465 = 807.
27
-
#
28
-
#
29
-
#
1
+
# Tag: Linked List, Math, Recursion
2
+
# Time: O(N + M)
3
+
# Space: O(1)
4
+
# Ref: -
5
+
# Note: -
6
+
7
+
# You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
8
+
# You may assume the two numbers do not contain any leading zero, except the number 0 itself.
9
+
#
10
+
# Example 1:
11
+
#
12
+
#
13
+
# Input: l1 = [2,4,3], l2 = [5,6,4]
14
+
# Output: [7,0,8]
15
+
# Explanation: 342 + 465 = 807.
16
+
#
17
+
# Example 2:
18
+
#
19
+
# Input: l1 = [0], l2 = [0]
20
+
# Output: [0]
21
+
#
22
+
# Example 3:
23
+
#
24
+
# Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
25
+
# Output: [8,9,9,9,0,0,0,1]
26
+
#
27
+
#
28
+
# Constraints:
29
+
#
30
+
# The number of nodes in each linked list is in the range [1, 100].
31
+
# 0 <= Node.val <= 9
32
+
# It is guaranteed that the list represents a number that does not have leading zeros.
Copy file name to clipboardExpand all lines: leetcode/2379.minimum-recolors-to-get-k-consecutive-black-blocks.cpp
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// Space: O(1)
4
4
// Ref: -
5
5
// Note: -
6
+
// Video: https://youtu.be/2beK-k1hnmA
6
7
7
8
// You are given a 0-indexed string blocks of length n, where blocks[i] is either 'W' or 'B', representing the color of the ith block. The characters 'W' and 'B' denote the colors white and black, respectively.
8
9
// You are also given an integer k, which is the desired number of consecutive black blocks.
Copy file name to clipboardExpand all lines: leetcode/2379.minimum-recolors-to-get-k-consecutive-black-blocks.py
+6-8Lines changed: 6 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
# Space: O(1)
4
4
# Ref: -
5
5
# Note: -
6
+
# Video: https://youtu.be/2beK-k1hnmA
6
7
7
8
# You are given a 0-indexed string blocks of length n, where blocks[i] is either 'W' or 'B', representing the color of the ith block. The characters 'W' and 'B' denote the colors white and black, respectively.
8
9
# You are also given an integer k, which is the desired number of consecutive black blocks.
0 commit comments