Given an integer array nums of length n, which is a permutation of
For any permutation perm of
$ ext{score}(perm) = \sum_{i = 0}^{n - 1} |perm[i] - nums[perm[(i + 1) \bmod n]}|$
Return the permutation perm that achieves the minimum score. If multiple permutations achieve the minimum score, return the lexicographically smallest permutation among them.
Constraints:
nums.length
nums is a permutation of
Given an integer array nums of length n, which is a permutation of
For any permutation perm of
$ ext{score}(perm) = \sum_{i = 0}^{n - 1} |perm[i] - nums[perm[(i + 1) \bmod n]}|$
Return the permutation perm that achieves the minimum score. If multiple permutations achieve the minimum score, return the lexicographically smallest permutation among them.
Constraints:
nums.length
nums is a permutation of