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
- 你可以假设 nums1 有足够的空间(空间大小大于或等于 m + n)来保存 nums2 中的元素。
17
+
18
+
**示例:**
19
+
20
+
```
21
+
输入:
22
+
nums1 = [1,2,3,0,0,0], m = 3
23
+
nums2 = [2,5,6], n = 3
24
+
25
+
输出: [1,2,2,3,5,6]
26
+
```
14
27
15
-
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
11
-
12
-
Do not allocate extra space for another array, you must do this in place with constant memory.
13
-
14
-
For example,
15
-
Given input array nums = [1,1,2],
16
-
17
-
Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn't matter what you leave beyond the new length.
Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3. It doesn't matter what you leave beyond the new length.
0 commit comments