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
| 0138 |[Copy List with Random Pointer](src/main/ts/g0101_0200/s0138_copy_list_with_random_pointer/solution.ts)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Hash_Table, Linked_List, Big_O_Time_O(N)_Space_O(N) | 49 | 72.42
1083
+
| 0092 |[Reverse Linked List II](src/main/ts/g0001_0100/s0092_reverse_linked_list_ii/solution.ts)| Medium | Linked_List | 0 | 100.00
1080
1084
| 0025 |[Reverse Nodes in k-Group](src/main/ts/g0001_0100/s0025_reverse_nodes_in_k_group/solution.ts)| Hard | Top_100_Liked_Questions, Linked_List, Recursion, Big_O_Time_O(n)_Space_O(k) | 0 | 100.00
1081
1085
| 0019 |[Remove Nth Node From End of List](src/main/ts/g0001_0100/s0019_remove_nth_node_from_end_of_list/solution.ts)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Two_Pointers, Linked_List, Big_O_Time_O(L)_Space_O(L) | 0 | 100.00
1086
+
| 0082 |[Remove Duplicates from Sorted List II](src/main/ts/g0001_0100/s0082_remove_duplicates_from_sorted_list_ii/solution.ts)| Medium | Two_Pointers, Linked_List | 0 | 100.00
Given an integer array `nums` sorted in **non-decreasing order**, remove some duplicates [**in-place**](https://en.wikipedia.org/wiki/In-place_algorithm) such that each unique element appears **at most twice**. The **relative order** of the elements should be kept the **same**.
6
+
7
+
Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the **first part** of the array `nums`. More formally, if there are `k` elements after removing the duplicates, then the first `k` elements of `nums` should hold the final result. It does not matter what you leave beyond the first `k` elements.
8
+
9
+
Return `k`_after placing the final result in the first_`k`_slots of_`nums`.
10
+
11
+
Do **not** allocate extra space for another array. You must do this by **modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm)** with O(1) extra memory.
12
+
13
+
**Custom Judge:**
14
+
15
+
The judge will test your solution with the following code:
16
+
17
+
int[] nums = [...]; // Input array
18
+
int[] expectedNums = [...]; // The expected answer with correct length
19
+
20
+
int k = removeDuplicates(nums); // Calls your implementation
21
+
22
+
assert k == expectedNums.length;
23
+
for (int i = 0; i < k; i++) {
24
+
assert nums[i] == expectedNums[i];
25
+
}
26
+
27
+
If all assertions pass, then your solution will be **accepted**.
28
+
29
+
**Example 1:**
30
+
31
+
**Input:** nums = [1,1,1,2,2,3]
32
+
33
+
**Output:** 5, nums = [1,1,2,2,3,\_]
34
+
35
+
**Explanation:** Your function should return k = 5, with the first five elements of nums being 1, 1, 2, 2 and 3 respectively. It does not matter what you leave beyond the returned k (hence they are underscores).
36
+
37
+
**Example 2:**
38
+
39
+
**Input:** nums = [0,0,1,1,1,1,2,3,3]
40
+
41
+
**Output:** 7, nums = [0,0,1,1,2,3,3,\_,\_]
42
+
43
+
**Explanation:** Your function should return k = 7, with the first seven elements of nums being 0, 0, 1, 1, 2, 3 and 3 respectively. It does not matter what you leave beyond the returned k (hence they are underscores).
Given the `head` of a sorted linked list, _delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list_. Return _the linked list **sorted** as well_.
Given the `head` of a linked list and a value `x`, partition it such that all nodes **less than**`x` come before nodes **greater than or equal** to `x`.
6
+
7
+
You should **preserve** the original relative order of the nodes in each of the two partitions.
You are given two integer arrays `nums1` and `nums2`, sorted in **non-decreasing order**, and two integers `m` and `n`, representing the number of elements in `nums1` and `nums2` respectively.
6
+
7
+
**Merge**`nums1` and `nums2` into a single array sorted in **non-decreasing order**.
8
+
9
+
The final sorted array should not be returned by the function, but instead be _stored inside the array_`nums1`. To accommodate this, `nums1` has a length of `m + n`, where the first `m` elements denote the elements that should be merged, and the last `n` elements are set to `0` and should be ignored. `nums2` has a length of `n`.
10
+
11
+
**Example 1:**
12
+
13
+
**Input:** nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3
14
+
15
+
**Output:**[1,2,2,3,5,6]
16
+
17
+
**Explanation:** The arrays we are merging are [1,2,3] and [2,5,6]. The result of the merge is [1,2,2,3,5,6] with the underlined elements coming from nums1.
18
+
19
+
**Example 2:**
20
+
21
+
**Input:** nums1 = [1], m = 1, nums2 = [], n = 0
22
+
23
+
**Output:**[1]
24
+
25
+
**Explanation:** The arrays we are merging are [1] and []. The result of the merge is [1].
26
+
27
+
**Example 3:**
28
+
29
+
**Input:** nums1 = [0], m = 0, nums2 = [1], n = 1
30
+
31
+
**Output:**[1]
32
+
33
+
**Explanation:** The arrays we are merging are [] and [1]. The result of the merge is [1]. Note that because m = 0, there are no elements in nums1. The 0 is only there to ensure the merge result can fit in nums1.
Given the `head` of a singly linked list and two integers `left` and `right` where `left <= right`, reverse the nodes of the list from position `left` to position `right`, and return _the reversed list_.
0 commit comments