Company: Flipkart grid 28 6pm retest
Difficulty: medium
Light-Cycle Duel Light-cycle racing takes place inside a rectangular grid. The lower-left corner of the grid is (0, 0) and the upper-right corner is (W, D) . Coordinates on the boundary are inside the grid, so a coordinate (x, y) is inside the grid exactly when 0 <= x <= W and 0 <= y <= D . Two players, A and B , start at two different positions and move simultaneously. Both players initially face east, toward the positive x-axis. Each player's path is given as a list of movement segments. A movement segment is a pair [T, k] : T is S , L , or R . - S means continue straight (no turn). - L means turn 90 degrees left. - R means turn 90 degrees right. k is the number of grid units to move after turning. Turning takes no time, so a segment [T, k] takes exactly k seconds. A player performs its segments in the given order and moves one grid unit per second. Every coordinate occupied by a player becomes a wall, including the player's starting coordinate. During each second both pl