A un robot se le ha dado una lista de instrucciones de movimiento. Cada instrucción es left, right, up o down, seguida de una distancia que debe recorrer. El robot comienza en [0, 0]. Debes calcular dónde terminará el robot y devolver su posición final como un arreglo.
Para ilustrarlo, si al robot se le dan las siguientes instrucciones:
new string[] { "right 10", "up 50", "left 30", "down 10" }Quedará 20 a la izquierda y 40 arriba de donde comenzó, así que devolvemos int[] { -20, 40 }.
TrackRobot(new string[] { "right 10", "up 50", "left 30", "down 10" }) ➞ int[] { -20, 40 }
TrackRobot(new string[] { }) ➞ int[] { 0, 0 }
// If there are no instructions, the robot doesn't move.
TrackRobot(new string[] { "right 100", "right 100", "up 500", "up 10000" }) ➞ new int[] { 200, 10500 }left, right, up o down.