10336

 

521

 

794

This one took me a looong time to figure out the solution, i used dynamic programming approach to modify the bfs traversal.

 

710

This is quite an easy problem. But it took me long time to realize that to determine the number of total game segments is nothing but counting the direction changes to reach the destination.

 

633

 

627

There is another solution using Linked List in case Router ID is not limited from 1 to 300. But for this problem this solution gets TLE.

   

321

I used bit operation to represent the states of the switches state of the villa.

 

314

 

298

 

10067