Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
I want recursive regex patterns... solution in Creative category for Saw the Stick by ale1ster
from functools import reduce
def checkio(n):
lst = reduce(lambda a,x: a + [a[-1] + x], range(1,int((2*n)**.5+1)), [0])[1:]
(i, j) = (0, 1)
while i < len(lst) and sum(lst[i:j]) != n:
(i, j) = (i+1, i+2) if j > len(lst) else (i, j+1)
return lst[i:j]
June 8, 2014