Skip to content

Instantly share code, notes, and snippets.

@HauptJ
Created December 3, 2025 04:17
Show Gist options
  • Select an option

  • Save HauptJ/1a874e254f07dea5f6f4ec5cc13c555b to your computer and use it in GitHub Desktop.

Select an option

Save HauptJ/1a874e254f07dea5f6f4ec5cc13c555b to your computer and use it in GitHub Desktop.
// you can also use imports, for example:
import java.util.Arrays;
// you can write to stdout for debugging purposes, e.g.
// System.out.println("this is a debug message");
class Solution {
public int solution(int[] A) {
int res = 1;
// Implement your solution here
Arrays.sort(A);
for(int i = 0; i < A.length; i++) {
if(A[i] == res) {
res++;
}
else if (A[i] > res) {
break;
}
}
return res;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment