Skip to content

Commit 9417091

Browse files
SandersLinpoyea
authored andcommitted
Update sol1.py (TheAlgorithms#643)
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.
1 parent 60418a6 commit 9417091

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

project_euler/problem_08/sol1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
def main():
33
LargestProduct = -sys.maxsize-1
44
number=input().strip()
5-
for i in range(len(number)-13):
5+
for i in range(len(number)-12):
66
product=1
77
for j in range(13):
88
product *= int(number[i+j])

0 commit comments

Comments
 (0)