List value reduction algorithm
问题 Forgive me, but I am very confused and I cannot find any sources that are pointing my in the right direction. Given list of n elements: [3, 6, 5, 1] Reduce the values to be no larger than the size of the list while keeping prioritization values relative to one another (In their original order). Constraints: Order must be maintained Elements are >= 0 Distinct values I am trying to stay away from sorting and creating a new list, but modifying the list in-place. What my expected outcome should