Company: Amazon_29march
Difficulty: medium
The developers at Amazon are working on fixing a bug where a HTTP request is being redirected to different servers. There are n servers are placed [unclear] infinite 2D plane, each defined by their x and y co-[unclear], where the i th coordinate is represented by array locations[i] . Additionally, there are q redirectRecords that [unclear] the directions in which the requests were redir[unclear] where the i th redirection is represented by redirectRecords[i] . The request is being redirected from one server (a, b) to another server in the following ways (Here, Z is an [unclear] positive integer, i.e., Z ≥ 1): Direction 1: (a, b) → (a + Z, b + Z) . Direction 2: (a, b) → (a + Z, b - Z) . Direction 3: (a, b) → (a - Z, b + Z) . Direction 4: (a, b) → (a - Z, b [unclear]) . The request is redirected to the nearest server present in the given direction, out of the 4 directions which have been specified above from the current server. The below rules [unclear] when the re