Skip to content

Commit 7af2398

Browse files
authored
Create pass-the-pillow.py
1 parent 1b156e0 commit 7af2398

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Python/pass-the-pillow.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Time: O(1)
2+
# Space: O(1)
3+
4+
# math
5+
class Solution(object):
6+
def passThePillow(self, n, time):
7+
"""
8+
:type n: int
9+
:type time: int
10+
:rtype: int
11+
"""
12+
return n-abs((n-1)-(time%(2*(n-1))))

0 commit comments

Comments
 (0)