Escape from grid

Problem Name:
Escape from grid
Site:HackerEarth
Links:
Tags:
Problem setters: