Company: flipkart_8aug
Difficulty: medium
Snake Movement Simulation Problem Description In a popular video game, a snake moves inside a two-dimensional square grid based on a set of fixed instructions. As the snake traverses its path in the grid, it leaves behind a trail of poison along the path it travels. If the snake crosses that path again, the poison will kill it, and thus end the game. A second way to end the game is if the snake falls off the grid. The square grid is a representation of the first quadrant of the cartesian plane i.e. (0, 0) is at bottom left of the grid, x values increase as we go right, and y values increase as we go up. Given the grid, starting position and the path of the snake during the game, write a program to determine the final position of the snake when the game ends, and if the snake is alive or dead at the end. The starting coordinates of the snake are given as (x, y). Initially, the snake faces to the east, that is, in the same direction as the positive x-axis. The path is described as a seri