β back to unit
Medium
# queues medium
The Night Watch
The guards rotate shifts in strict order, night after night, forever. π
You get the guards and a number of nights. Print the guard on duty for each night, in order, space-separated.
Example:
Input: guards = ["sir-reg", "dame-flo", "sir-pod"], nights = 5
Output: sir-reg dame-flo sir-pod sir-reg dame-flo
Night i (counting from 0) belongs to guard i % 3, cycling through the roster and wrapping back around after night 2.
π‘ need a hint?
q-night-watch.pyπ given lines are locked β write your code in between
loading...