Skip to content

Instantly share code, notes, and snippets.

@jezinka

jezinka/brute_force.py Secret

Created Jul 2, 2018
Embed
What would you like to do?
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