Minimum operations to change given array with at most 1 duplicate into a permutation of 1 to N
Given an array arr[] having N integers in the range [1, N] with at most one repeated element, the task is to find the minimum number of increment or decrement operations required to make the given array a permutation of numbers from 1 to N. Examples: Input: arr[] = {1, 2, 5, 3, 2} Output: 2 Explanat