arpita.tanvi21
BAN USER- 1of 1 vote
AnswersAmazon has N buildings on the site, building ID ranged from 0 to N-1
- arpita.tanvi21 in United States
Every employee has an office space in one of the buildings.
Now employee may make a request to move from current building X to
another building Y. A moving request is noted by
Class Request{
String employee names;
int from building;
int to building;
}
Initially all buildings are full. A request from building X to building Y is
achievable only if someone in building Y made an achievable requests to
move away and therefore creates a vacancy
Given a wishlist of requests, help us plan for the best way of building
swaps. A plan that fulfill the maximum number requests is considered
the best
Output is a list of employee names on cyclic swaps.
For Ex:
Input :
List<Request requests{
<"Alex" 1, 2>,
<"Ben", 2, 1>,
<"Chris", 1, 2>,
<"David", 2, 3>,
<"Ellen", 3, 1>,
<"Frank", 4, 5>
}
Expected Output:
List<List>
[ ["Alex","Ben"],["Chris","David","Ellen"] ]
Can someone please help me how to solve this one?| Report Duplicate | Flag | PURGE
Software Developer