diff --git a/easy/pass_the_pillow.py b/easy/pass_the_pillow.py new file mode 100644 index 0000000..e520036 --- /dev/null +++ b/easy/pass_the_pillow.py @@ -0,0 +1,6 @@ +# https://leetcode.com/problems/pass-the-pillow + +class Solution: + def passThePillow(self, n: int, time: int) -> int: + pos = time % (2 * (n - 1)) + return n - abs(n - 1 - pos)