Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Saw the Stick by David_Jones
def checkio(number):
TRIANGULAR_NUMBERS = [i*(i+1)//2 for i in range(1, 45)]
pieces = {}
for k in range(1, 45):
for i in range(45 - k):
fragment = TRIANGULAR_NUMBERS[i:i+k]
pieces[sum(fragment)] = fragment
return pieces[number] if number in pieces else []
May 16, 2019