Skip to content

Instantly share code, notes, and snippets.

View yeelan0319's full-sized avatar

Yiran Mao yeelan0319

View GitHub Profile
(29, 30) min: 30
(29, 30): [29, 30]
(28, 29) min: 29
(28, 29): [28, 29]
(28, 30) min: 30
(28, 30): [57, 29, 58]
(27, 28) min: 28
(27, 28): [27, 28]
(27, 29) min: 29
(27, 29): [55, 28, 56]
@yeelan0319
yeelan0319 / rotate.py
Created February 18, 2017 06:40
Rotate a list with test
class Solution(object):
def rotate(self, nums, k):
n = len(nums)
if n == 0:
return
start = 0
count = 0
while count < n:
curr = start
tmp = nums[curr]