Skip to content

Commit ab2163c

Browse files
Create triangularSum.py
1 parent a71618f commit ab2163c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

triangularSum.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def triangularSum(self, nums):
3+
current = nums[:]
4+
while len(current) > 1:
5+
new_nums = []
6+
for i in range(len(current) - 1):
7+
new_nums.append((current[i] + current[i + 1]) % 10)
8+
current = new_nums
9+
return current[0]

0 commit comments

Comments
 (0)