Java Perm Check
import java.util.Arrays;
public class Solution {
public static int permCheck(int[] a) {
int[] sorted = a.clone();
Arrays.sort(sorted);
for (int k = 0; k < sorted.length - 1; k++) {
if (sorted[k] != k + 1) {
return 0;
}
}
return 1;
}
}
This validates that every value from 1 to N appears exactly once.