Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created July 2, 2018 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jezinka/666182658ca933dc31928a41d432cc17 to your computer and use it in GitHub Desktop.
Save jezinka/666182658ca933dc31928a41d432cc17 to your computer and use it in GitHub Desktop.
def ex8(window_size):
large_number = open("source.txt", 'r').read()
max_product = 1
for i in range(0, len(large_number)):
product = 1
if i + window_size <= len(large_number):
for j in range(i, i + window_size):
product *= int(large_number[j])
max_product = max(max_product, product)
return max_product
assert ex8(4) == 5832
print(ex8(13))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment