Skip to content

Commit 1c55dc6

Browse files
authored
Update minimum-number-of-pushes-to-type-word-i.py
1 parent 2b5a08e commit 1c55dc6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/minimum-number-of-pushes-to-type-word-i.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def minimumPushes(self, word):
1111
def ceil_divide(a, b):
1212
return (a+b-1)//b
1313

14-
return sum(i*min(len(word)-(i-1)*(9-2+1), (9-2+1)) for i in xrange(1, ceil_divide(len(word), (9-2+1))+1))
14+
return sum((i+1)*min(len(word)-i*(9-2+1), (9-2+1)) for i in xrange(ceil_divide(len(word), (9-2+1))))
1515

1616

1717
# Time: O(26)

0 commit comments

Comments
 (0)