diff --git a/go/pass-the-pillow.go b/go/pass-the-pillow.go new file mode 100644 index 0000000..2b956d3 --- /dev/null +++ b/go/pass-the-pillow.go @@ -0,0 +1,10 @@ +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 +}