We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There are some soldiers placed on the map at some locations - which we know beforehand.
We also know how the map is constructed - note that all paths are one way.
For Example,
in the first test case, there are four soldiers each at locations 4,6,7 and 10.
There is no path from 4 and 10.
There is only one path from 6 (to 8).
There are three choices for location 7 (to 4,6,8).
Bumi starts and will choose the path 7->6, then Iroh chooses 6->8 (there are 2 such soldiers at 6 - so only one is moved to 8).
Bumi then moves the other soldier at 6 to 8.
Now, there are no more possibilities of movement. Hence, Bumi wins.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Play on benders
You are viewing a single comment's thread. Return to all comments →
There are some soldiers placed on the map at some locations - which we know beforehand. We also know how the map is constructed - note that all paths are one way.
For Example, in the first test case, there are four soldiers each at locations 4,6,7 and 10. There is no path from 4 and 10. There is only one path from 6 (to 8). There are three choices for location 7 (to 4,6,8).
Bumi starts and will choose the path 7->6, then Iroh chooses 6->8 (there are 2 such soldiers at 6 - so only one is moved to 8). Bumi then moves the other soldier at 6 to 8.
Now, there are no more possibilities of movement. Hence, Bumi wins.