Google | SDE | 2 Jan
Google · Question · Posted Apr 2020
In chess, each move of a knight consists of moving by two squares horizontally and one square vertically, or by one square horizontally and two squares vertically. A knight making one move from location (0,0) of an infinite chess board would end up at one of the following eight locations: (1,2), (-1,2), (1,-2), (-1,-2), (2,1), (-2,1), (2,-1), (-2,-1). Starting from location (0,0), what is the minimum number of moves required for a knight to get to some other arbitrary location ...
The full answer & interview discussion are available to premium members.
Log in Create a free account