Skip to content

Commit

Permalink
Update sol1.py (TheAlgorithms#643)
Browse files Browse the repository at this point in the history
small off by one error. Boundary condition: if len(number) =13 , we would need to check exactly 1 combination, namely number itself. However  for i in range(len(number)-13): will iterate 0 times.
  • Loading branch information
SandersLin authored and poyea committed Feb 13, 2019
1 parent 60418a6 commit 9417091
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion project_euler/problem_08/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
def main():
LargestProduct = -sys.maxsize-1
number=input().strip()
for i in range(len(number)-13):
for i in range(len(number)-12):
product=1
for j in range(13):
product *= int(number[i+j])
Expand Down

0 comments on commit 9417091

Please sign in to comment.