## Code ```java= class Solution { public List<Integer> relocateMarbles(int[] nums, int[] moveFrom, int[] moveTo) { Set<Integer> marbles = new HashSet<>(); for(int num:nums) marbles.add(num); for(int i=0; i<moveFrom.length; i++){ if(marbles.contains(moveFrom[i])){ marbles.remove(moveFrom[i]); marbles.add(moveTo[i]); } } List<Integer> ans = new ArrayList<>(marbles); Collections.sort(ans); return ans; } } ``` ```python= class Solution: def relocateMarbles(self, nums: List[int], moveFrom: List[int], moveTo: List[int]) -> List[int]: s = set(nums) for f, t in zip(moveFrom, moveTo): s.remove(f) s.add(t) return sorted(s) ```