12160 - Unlock the Lock
Solution Description : Simple BFS problem Input 5234 1212 3 1023 0101 0001 In 0 state you can got 5234 In 1 state you can got (5234+1023)%10000 (5234+0101)%10000 (5234+0001)%10000 So, start node=L You can got R adjacency node for all node, (RVi+Parent Node)%10000 In this problem you can got maximum node 10000 number from 0 to 9999 do not need to push any visited node. If you can find U then print state Otherwise print Permanently Locked |
||||||||||