Codility PermMissingElem

Solution

import java.util.*;

class Solution {
    public int solution(int[] A) {

        Arrays.sort(A);

        for (int i=1; i<=A.length;i++) {
            if (i!=A[i-1]) {
                return i;
            }
        }

        return A.length+1;
    }
}