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-2570](https://leetcode.com/problems/merge-two-2d-arrays-by-summing-values/)| Merge Two 2D Arrays By Summing Values |[c++](./leetcode/2570.merge-two-2d-arrays-by-summing-values.cpp), [python3](./leetcode/2570.merge-two-2d-arrays-by-summing-values.py)| Two Pointers | O\(N\)| O\(1\)| - |
932
932
|[Leetcode-876](https://leetcode.com/problems/middle-of-the-linked-list/)| Middle Of The Linked List |[c++](./leetcode/876.middle-of-the-linked-list.cpp), [python3](./leetcode/876.middle-of-the-linked-list.py)| Two Pointers | O\(N\)| O\(1\)| - |
933
933
|[Leetcode-1750](https://leetcode.com/problems/minimum-length-of-string-after-deleting-similar-ends/)| Minimum Length Of String After Deleting Similar Ends |[c++](./leetcode/1750.minimum-length-of-string-after-deleting-similar-ends.cpp), [python3](./leetcode/1750.minimum-length-of-string-after-deleting-similar-ends.py)| Two Pointers | O\(N\)| O\(1\)| - |
|[Leetcode-1040](https://leetcode.com/problems/moving-stones-until-consecutive-ii/)| Moving Stones Until Consecutive II |[c++](./leetcode/1040.moving-stones-until-consecutive-ii.cpp), [python3](./leetcode/1040.moving-stones-until-consecutive-ii.py)| Two Pointers | O\(NlogN\)| O\(1\)| - |
935
936
|[Leetcode-1498](https://leetcode.com/problems/number-of-subsequences-that-satisfy-the-given-sum-condition/)| Number Of Subsequences That Satisfy The Given Sum Condition |[c++](./leetcode/1498.number-of-subsequences-that-satisfy-the-given-sum-condition.cpp), [python3](./leetcode/1498.number-of-subsequences-that-satisfy-the-given-sum-condition.py)| Two Pointers | O\(NlogN\)| O\(1\)| - |
936
937
|[Leetcode-1577](https://leetcode.com/problems/number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers/)| Number Of Ways Where Square Of Number Is Equal To Product Of Two Numbers |[c++](./leetcode/1577.number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers.cpp), [python3](./leetcode/1577.number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers.py)| Two Pointers | O\(NM\)| O\(N \+ M\)| - |
|[Leetcode-2122](https://leetcode.com/problems/recover-the-original-array/)| Recover The Original Array |[c++](./leetcode/2122.recover-the-original-array.cpp), [python3](./leetcode/2122.recover-the-original-array.py)| Two Pointers | O\(N^2\)| O\(1\)| - |
944
+
|[Leetcode-26](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| Remove Duplicates From Sorted Array |[c++](./leetcode/26.remove-duplicates-from-sorted-array.cpp), [python3](./leetcode/26.remove-duplicates-from-sorted-array.py)| Two Pointers | O\(N\)| O\(1\)| - |
945
+
|[Leetcode-80](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/)| Remove Duplicates From Sorted Array II |[c++](./leetcode/80.remove-duplicates-from-sorted-array-ii.cpp), [python3](./leetcode/80.remove-duplicates-from-sorted-array-ii.py)| Two Pointers | O\(N\)| O\(1\)| - |
946
+
|[Leetcode-27](https://leetcode.com/problems/remove-element/)| Remove Element |[c++](./leetcode/27.remove-element.cpp), [python3](./leetcode/27.remove-element.py)| Two Pointers | O\(N\)| O\(1\)| - |
943
947
|[Leetcode-19](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)| Remove Nth Node From End Of List |[c++](./leetcode/19.remove-nth-node-from-end-of-list.cpp), [python3](./leetcode/19.remove-nth-node-from-end-of-list.py)| Two Pointers | O\(N\)| O\(1\)| - |
|[Leetcode-1574](https://leetcode.com/problems/shortest-subarray-to-be-removed-to-make-array-sorted/)| Shortest Subarray To Be Removed To Make Array Sorted |[c++](./leetcode/1574.shortest-subarray-to-be-removed-to-make-array-sorted.cpp), [python3](./leetcode/1574.shortest-subarray-to-be-removed-to-make-array-sorted.py)| Two Pointers | O\(N\)| O\(1\)| - |
|[Leetcode-905](https://leetcode.com/problems/sort-array-by-parity/)| Sort Array By Parity |[c++](./leetcode/905.sort-array-by-parity.cpp), [python3](./leetcode/905.sort-array-by-parity.py)| Two Pointers | O\(N\)| O\(1\)| - |
953
+
|[Leetcode-922](https://leetcode.com/problems/sort-array-by-parity-ii/)| Sort Array By Parity II |[c++](./leetcode/922.sort-array-by-parity-ii.cpp), [python3](./leetcode/922.sort-array-by-parity-ii.py)| Two Pointers | O\(N\)| O\(1\)| - |
|[Leetcode-148](https://leetcode.com/problems/sort-list/)| Sort List |[c++](./leetcode/148.sort-list.cpp), [python3](./leetcode/148.sort-list.py)| Two Pointers | O\(NlogN\)| O\(logN\)| - |
950
956
|[Leetcode-1616](https://leetcode.com/problems/split-two-strings-to-make-palindrome/)| Split Two Strings To Make Palindrome |[c++](./leetcode/1616.split-two-strings-to-make-palindrome.cpp), [python3](./leetcode/1616.split-two-strings-to-make-palindrome.py)| Two Pointers | O\(N\)| O\(1\)| - |
|[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)| Sorting | O\(NlogN\)| O\(N\)| - |
|[Leetcode-928](https://leetcode.com/problems/minimize-malware-spread-ii/)| Minimize Malware Spread II |[python3](./leetcode/928.minimize-malware-spread-ii.py)| Other |\-|\-| - |
1620
1628
|[Leetcode-433](https://leetcode.com/problems/minimum-genetic-mutation/)| Minimum Genetic Mutation |[c++](./leetcode/433.minimum-genetic-mutation.cpp), [python3](./leetcode/433.minimum-genetic-mutation.py)| Other |\-|\-| - |
1621
1629
|[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 |\-|\-| - |
1622
-
|[Leetcode-283](https://leetcode.com/problems/move-zeroes/)| Move Zeroes |[c++](./leetcode/283.move-zeroes.cpp), [python3](./leetcode/283.move-zeroes.py)| Other |\-|\-| - |
1623
1630
|[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 |\-|\-| - |
1624
1631
|[Leetcode-31](https://leetcode.com/problems/next-permutation/)| Next Permutation |[c++](./leetcode/31.next-permutation.cpp), [python3](./leetcode/31.next-permutation.py)| Other |\-|\-| - |
1625
1632
|[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 |\-|\-| - |
|[Leetcode-119](https://leetcode.com/problems/pascals-triangle-ii/)| Pascals Triangle II |[c++](./leetcode/119.pascals-triangle-ii.cpp), [python3](./leetcode/119.pascals-triangle-ii.py)| Other |\-|\-| - |
1635
1642
|[Leetcode-66](https://leetcode.com/problems/plus-one/)| Plus One |[c++](./leetcode/66.plus-one.cpp), [python3](./leetcode/66.plus-one.py)| Other |\-|\-| - |
1636
1643
|[Leetcode-755](https://leetcode.com/problems/pour-water/)| Pour Water |[python3](./leetcode/755.pour-water.py)| Other |\-|\-| - |
1637
-
|[Leetcode-26](https://leetcode.com/problems/remove-duplicates-from-sorted-array/)| Remove Duplicates From Sorted Array |[c++](./leetcode/26.remove-duplicates-from-sorted-array.cpp), [python3](./leetcode/26.remove-duplicates-from-sorted-array.py)| Other |\-|\-| - |
1638
-
|[Leetcode-27](https://leetcode.com/problems/remove-element/)| Remove Element |[c++](./leetcode/27.remove-element.cpp), [python3](./leetcode/27.remove-element.py)| Other |\-|\-| - |
1639
1644
|[Leetcode-203](https://leetcode.com/problems/remove-linked-list-elements/)| Remove Linked List Elements |[python3](./leetcode/203.remove-linked-list-elements.py)| Other |\-|\-| - |
1640
1645
|[Leetcode-143](https://leetcode.com/problems/reorder-list/)| Reorder List |[python3](./leetcode/143.reorder-list.py)| Other |\-|\-| - |
1641
1646
|[Leetcode-7](https://leetcode.com/problems/reverse-integer/)| Reverse Integer |[c++](./leetcode/7.reverse-integer.cpp), [python3](./leetcode/7.reverse-integer.py)| Other |\-|\-| - |
// Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums.
8
+
// Consider the number of unique elements of nums to be k, to get accepted, you need to do the following things:
9
+
//
10
+
// Change the array nums such that the first k elements of nums contain the unique elements in the order they were present in nums initially. The remaining elements of nums are not important as well as the size of nums.
11
+
// Return k.
12
+
//
13
+
// Custom Judge:
14
+
// The judge will test your solution with the following code:
15
+
//
16
+
// int[] nums = [...]; // Input array
17
+
// int[] expectedNums = [...]; // The expected answer with correct length
18
+
//
19
+
// int k = removeDuplicates(nums); // Calls your implementation
20
+
//
21
+
// assert k == expectedNums.length;
22
+
// for (int i = 0; i < k; i++) {
23
+
// assert nums[i] == expectedNums[i];
24
+
// }
25
+
//
26
+
// If all assertions pass, then your solution will be accepted.
27
+
//
28
+
// Example 1:
29
+
//
30
+
// Input: nums = [1,1,2]
31
+
// Output: 2, nums = [1,2,_]
32
+
// Explanation: Your function should return k = 2, with the first two elements of nums being 1 and 2 respectively.
33
+
// It does not matter what you leave beyond the returned k (hence they are underscores).
34
+
//
35
+
// Example 2:
36
+
//
37
+
// Input: nums = [0,0,1,1,1,2,2,3,3,4]
38
+
// Output: 5, nums = [0,1,2,3,4,_,_,_,_,_]
39
+
// Explanation: Your function should return k = 5, with the first five elements of nums being 0, 1, 2, 3, and 4 respectively.
40
+
// It does not matter what you leave beyond the returned k (hence they are underscores).
# Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums.
8
+
# Consider the number of unique elements of nums to be k, to get accepted, you need to do the following things:
9
+
#
10
+
# Change the array nums such that the first k elements of nums contain the unique elements in the order they were present in nums initially. The remaining elements of nums are not important as well as the size of nums.
11
+
# Return k.
12
+
#
13
+
# Custom Judge:
14
+
# The judge will test your solution with the following code:
15
+
#
16
+
# int[] nums = [...]; // Input array
17
+
# int[] expectedNums = [...]; // The expected answer with correct length
18
+
#
19
+
# int k = removeDuplicates(nums); // Calls your implementation
20
+
#
21
+
# assert k == expectedNums.length;
22
+
# for (int i = 0; i < k; i++) {
23
+
# assert nums[i] == expectedNums[i];
24
+
# }
25
+
#
26
+
# If all assertions pass, then your solution will be accepted.
27
+
#
28
+
# Example 1:
29
+
#
30
+
# Input: nums = [1,1,2]
31
+
# Output: 2, nums = [1,2,_]
32
+
# Explanation: Your function should return k = 2, with the first two elements of nums being 1 and 2 respectively.
33
+
# It does not matter what you leave beyond the returned k (hence they are underscores).
34
+
#
35
+
# Example 2:
36
+
#
37
+
# Input: nums = [0,0,1,1,1,2,2,3,3,4]
38
+
# Output: 5, nums = [0,1,2,3,4,_,_,_,_,_]
39
+
# Explanation: Your function should return k = 5, with the first five elements of nums being 0, 1, 2, 3, and 4 respectively.
40
+
# It does not matter what you leave beyond the returned k (hence they are underscores).
0 commit comments