You are given an array nums of distinct positive integers.
You want to sort nums such that each element is ordered primarily in ascending order of its digit sum. If two elements have the identical digit sum, they should be ordered in ascending order of their values.
Return the minimum number of swaps required to sort nums into this order.
Constraints:
nums.length
nums[i]
nums consists of distinct positive integers.
You are given an array nums of distinct positive integers.
You want to sort nums such that each element is ordered primarily in ascending order of its digit sum. If two elements have the identical digit sum, they should be ordered in ascending order of their values.
Return the minimum number of swaps required to sort nums into this order.
Constraints:
nums.length
nums[i]
nums consists of distinct positive integers.