Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
2,524 views
in Online Assessments by Expert (34,270 points) | 2,524 views

1 Answer

0 like 0 dislike
Amazon stores its data on different servers at different locations. From time to time, due to several factors, Amazon needs to move its data from one location to another. This challenge involved keeping track of the locations of Amazon's data and report them at the end of the year.

 

At the start of the year, Amazon's data was located at n different locations. Over the course of the year, Amazon's data was moved from one server to another m times. Precisely, in the ith operation, the data was moved from movedFrom[i] to moved To[i]. Find the locations of the data after all m moving operations. Return the locations in ascending order.

 

Note: It is guaranteed that for any movement of data: 4

 

There is data at movedFrom[i].

 

There is no data at moved To[i].

 

Example

 

locations = [1, 5, 2, 6] movedFrom = [1, 4, 5, 7] moved To = [4, 7, 1,3] output is 1 2 3 6
by Expert (34,270 points)