public class Solution { public int missingNumber(int[] nums) { int size = nums.length + 1; boolean[] found = new boolean[size]; for(int i = 0; i < size-1; i++) found[ nums[i] ] = true; for(int i = 0; i < size; i++) if(found[i] == false) return i; return size; } }
沒有留言:
張貼留言