Company: Flipkart_4aug
Difficulty: medium
Wizard Chess Escape Problem Description Harry is being chased by an unknown enemy while trying to get the Philosopher's Stone to a safe place. He stands on one corner of a giant wizard chess board, and the door to escape is at the diagonally opposite corner. A wizard chess board is always square, with N rows and N columns of blocks. In one step Harry moves from one complete block to an adjacent block in one of the four directions: forward, backward, left or right. Diagonal moves are not allowed, and Harry can never leave the board. Some blocks carry the mark of Voldemort. If Harry steps on any of those blocks, he instantly dies, so he must never stand on one. Harry stands on the top-left block, and the escape door is the bottom-right block. Find the least number of steps Harry needs to reach the escape door. If the door cannot be reached, print -1 . Input Format Read from standard input. N row 1 row 2 ... row N Line 1 contains the integer N , the side length of the board. Each of the n