We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23dabe3 commit 8734b30Copy full SHA for 8734b30
Algorithms/Easy/Remove Duplicates from Sorted Array
@@ -0,0 +1,27 @@
1
+class Solution {
2
+ public int removeDuplicates(int[] nums) {
3
+ int x = nums.length;
4
+ int i,j,k,z=0,m=0;
5
+ for( i =0; i< x;i++)
6
+ {
7
+ k = nums[i];
8
+ if(nums[i]!= 2147483647){
9
+ for( j = i+1; j < x; j++ ){
10
+
11
+ if(k == nums[j]) {
12
+ nums[j] = 2147483647;
13
+ }
14
15
16
17
+ for(int y =0;y<x;y++){
18
+ if(nums[y]!= 2147483647){
19
+ nums[z]= nums[y];
20
+ z++;
21
+ m++;
22
23
24
25
+ return m;
26
27
+}
0 commit comments