Skip to content

Instantly share code, notes, and snippets.

@Shubhaankar-Sharma
Created September 20, 2020 09:16
Show Gist options
  • Save Shubhaankar-Sharma/5bed60a24f360ab944435623bc462731 to your computer and use it in GitHub Desktop.
Save Shubhaankar-Sharma/5bed60a24f360ab944435623bc462731 to your computer and use it in GitHub Desktop.
solution for medium blog
def solution(k):
sizes = [x for x in range(1,k+1)]
yellow_apples = [box*box for box in sizes[0::2] ]
red_apples = [box*box for box in sizes[1::2] ]
return sum(red_apples)-sum(yellow_apples)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment