2
Approach :-> Given nums are from 0 to n-1 so to make local and global count3
equal it must have swapping between adjacent element in sorted array so for any4
element at index if it is either swapped with i or i+1 or i-1 this is only5
condition when both are equal else it got swapped with j > i+1 or j<i-1 then6
global count become greater than local count10
bool isIdealPermutation(vector<int> &nums) {11
for (int i = 0; i < nums.size(); i++) {12
if (nums[i] == i || nums[i] == i - 1 || nums[i] == i + 1)