def rotate(lst, n):
n = n % len(lst)
x, y = lst[:n], lst[n:]
return y + x
Sunday, November 2, 2008
99 problems - python - 19
Rotate a list N places to the left.
Labels:
99 problems,
python
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment