Gira y toca el suelo
Cada "left" o "right" representa un giro de 90 grados. Ten en cuenta el giro neto: los giros a la izquierda y a la derecha se cancelan entre sí. Devuelve el número no negativo de vueltas completas de 360 grados en el giro neto, sin contar ninguna vuelta incompleta.
Ejemplos
spinAround(["left", "right", "left", "right"]) ➞ 0
spinAround(["right", "right", "right", "right", "right", "right", "right", "right"]) ➞ 2
spinAround(["left", "left", "left", "left"]) ➞ 1Notas
- Devuelve un número no negativo.
- Todas las pruebas incluirán únicamente las palabras
"right"y"left".