mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-14 01:49:41 +01:00
10 lines
169 B
Go
10 lines
169 B
Go
package main
|
|
|
|
func passThePillow(n int, time int) int {
|
|
rounds, leftover := time/(n-1), time%(n-1)
|
|
|
|
if rounds%2 == 0 {
|
|
return leftover + 1
|
|
}
|
|
return n - leftover
|
|
}
|