You are given a 0-indexed integer array
numsrepresenting the initial positions of some marbles. You are also given two 0-indexed integer arraysmoveFromandmoveToof equal length.Throughout
moveFrom.lengthsteps, you will change the positions of the marbles. On theithstep, 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 { |