Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public int solution(int[] A) {
- ArrayList <Integer> listToSort = new ArrayList <Integer>();
- int lowestValue = 1;
- for (int i = 0; i<A.length; i++){
- if (A[i]>0){
- listToSort.add(A[i]);
- }
- }
- Collections.sort(listToSort);
- System.out.println(listToSort);
- for (int i = 0; i<listToSort.size()-1; i++){
- if (listToSort.get(i) < i+1){
- lowestValue = listToSort.get(i)+1;
- }
- }
- return lowestValue;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement