Created
December 3, 2025 04:17
-
-
Save HauptJ/1a874e254f07dea5f6f4ec5cc13c555b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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