Skip to content

Commit 18f3d04

Browse files
refactor 26
1 parent 02e9d54 commit 18f3d04

File tree

1 file changed

+0
-30
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-30
lines changed

src/main/java/com/fishercoder/solutions/_26.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 26. Remove Duplicates from Sorted Array
5-
*
6-
* Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.
7-
* Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
8-
*
9-
* Example 1:
10-
* Given nums = [1,1,2],
11-
* Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively.
12-
* It doesn't matter what you leave beyond the returned length.
13-
*
14-
* Example 2:
15-
* Given nums = [0,0,1,1,1,2,2,3,3,4],
16-
* Your function should return length = 5, with the first five elements of nums being modified to 0, 1, 2, 3, and 4 respectively.
17-
* It doesn't matter what values are set beyond the returned length.
18-
*
19-
* Clarification:
20-
* Confused why the returned value is an integer but your answer is an array?
21-
* Note that the input array is passed in by reference, which means modification to the input array will be known to the caller as well.
22-
* Internally you can think of this:
23-
* // nums is passed in by reference. (i.e., without making a copy)
24-
* int len = removeDuplicates(nums);
25-
*
26-
* // any modification to nums in your function would be known by the caller.
27-
* // using the length returned by your function, it prints the first len elements.
28-
* for (int i = 0; i < len; i++) {
29-
* print(nums[i]);
30-
* }
31-
* */
32-
333
public class _26 {
344

355
public static class Solution1 {

0 commit comments

Comments
 (0)