Skip to content

Commit 425782f

Browse files
authored
Update largest-multiple-of-three.py
1 parent 9d403e4 commit 425782f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/largest-multiple-of-three.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ def candidates_gen(r):
4141
for j in xrange(i+1):
4242
yield [i, j]
4343

44-
count, total = collections.Counter(digits), sum(digits)
45-
for deletes in candidates_gen(total%3):
44+
count, r = collections.Counter(digits), sum(digits)%3
45+
for deletes in candidates_gen(r):
4646
delete_count = collections.Counter(deletes)
47-
if sum(deletes)%3 == total%3 and \
47+
if sum(deletes)%3 == r and \
4848
all(count[k] >= v for k, v in delete_count.iteritems()):
4949
for k, v in delete_count.iteritems():
5050
count[k] -= v

0 commit comments

Comments
 (0)