There are n people standing in a line, labeled sequentially from n. Initially, person
Every second, the person holding the pillow passes it to the next adjacent person. When the pillow reaches either end of the line, the direction reverses, and people continue passing it in the opposite direction.
Given two positive integers n and time, return the label of the person holding the pillow after time seconds.
Constraints:
n
time
There are n people standing in a line, labeled sequentially from n. Initially, person
Every second, the person holding the pillow passes it to the next adjacent person. When the pillow reaches either end of the line, the direction reverses, and people continue passing it in the opposite direction.
Given two positive integers n and time, return the label of the person holding the pillow after time seconds.
Constraints:
n
time