Skip to content

Commit

Permalink
add euler 067 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
kailanefelix committed Sep 26, 2021
1 parent aebae70 commit d9b48ee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions euler0XX/euler067.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
with open("euler067_triangle.txt", "r") as fp:

triangle = []
for line in fp:
numbers = line.split()

l = []
for i in numbers:
integer = int(i)
l.append(integer)

triangle.append(l)

for row in range(len(triangle) - 2, -1, -1):
line = triangle[row]
for col in range(len(line)):
adjacent = triangle[row + 1][col:col + 2]
triangle[row][col] = triangle[row][col] + max(adjacent)

print(triangle[0][0])

0 comments on commit d9b48ee

Please sign in to comment.