You are given an integer array, nums of size n, where each number is distinct and falls within the range [1,n]. Your task is to sort the array in place while ensuring a time complexity of O(n) and using only O(1) extra space.
Constraints:
n== nums.length
...