Skip to content

Commit 65aaba0

Browse files
authored
Update find-triangular-sum-of-an-array.py
1 parent bb7b408 commit 65aaba0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Python/find-triangular-sum-of-an-array.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ def triangularSum(self, nums):
88
:type nums: List[int]
99
:rtype: int
1010
"""
11-
def inv_mod(x, mod):
12-
y = x
13-
while y*x%10 != 1:
14-
y = y*x%10
15-
return y
16-
1711
def exp_mod(p, mod):
1812
result = [p]
1913
while result[-1]*p%10 != result[0]:
2014
result.append(result[-1]*p%10)
2115
return [result[-1]]+result[:-1]
2216

17+
def inv_mod(x, mod):
18+
y = x
19+
while y*x%10 != 1:
20+
y = y*x%10
21+
return y
22+
2323
def factor_p(x, p, cnt, diff):
2424
if x == 0:
2525
return x, cnt

0 commit comments

Comments
 (0)