775. Global and Local Inversions
Last updated
Last updated
/**
* Time complexity :
* Space complexity :
*/
class Solution {
public boolean isIdealPermutation(int[] A) {
for(int i = 0; i < A.length; i++) {
if(Math.abs(A[i]-i) > 1) {
return false;
}
}
return true;
}
}