Xoriant Interview Question

Rat and maze