Skip to content

Instantly share code, notes, and snippets.

@nphausg
Created December 9, 2021 06:44
Show Gist options
  • Select an option

  • Save nphausg/8681c62c3748eef5849066d337b166df to your computer and use it in GitHub Desktop.

Select an option

Save nphausg/8681c62c3748eef5849066d337b166df to your computer and use it in GitHub Desktop.
FindTheSmallestPositiveNumberMissing from an Sorted Array
/*
* Created by nphau on 09/12/2021, 00:30
* Copyright (c) 2021 . All rights reserved.
* Last modified 09/12/2021, 15:54
*/
public int solution(int[] numbers) {
Arrays.sort(numbers);
int min = 1;
for (int i : numbers){
if(i == min){
min ++;
}
}
return min;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment