- 1of 1 vote
There is a 2D grid and there are two players P1 and P2. Their x,y positions are given. Then there are N gems on the grid and their positions are also given. The two players together are supposed to collect the gems in the given sequence making minimum moves (movement in all 8 directions is considered as 1 move). Note: the gems should be collected in the given order by either one of the players and then their position then becomes the position of the gem.