You are given a 0-indexed integer array
nums
representing the initial positions of some marbles. You are also given two 0-indexed integer arraysmoveFrom
andmoveTo
of equal length.Throughout
moveFrom.length
steps, you will change the positions of the marbles. On theith
step, you will move all marbles at positionmoveFrom[i]
to positionmoveTo[i]
.After completing all the steps, return the sorted list of occupied positions.
Notes:
- We call a position occupied if there is at least one marble in that position.
- There may be multiple marbles in a single position.
1 | class Solution { |