Skip to content

Commit 6339cfc

Browse files
authored
Create Missing Number
1 parent 7d761f2 commit 6339cfc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Missing Number

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Arrays;
2+
3+
class Solution {
4+
public int missingNumber(int[] nums) {
5+
6+
Arrays.sort(nums);
7+
8+
for(int i = 0; i<nums.length;i++){
9+
if(nums[i] != i){
10+
return i;
11+
}
12+
}
13+
14+
return nums.length;
15+
}
16+
}

0 commit comments

Comments
 (0)