We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b5a08e commit 1c55dc6Copy full SHA for 1c55dc6
Python/minimum-number-of-pushes-to-type-word-i.py
@@ -11,7 +11,7 @@ def minimumPushes(self, word):
11
def ceil_divide(a, b):
12
return (a+b-1)//b
13
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))
+ 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))))
15
16
17
# Time: O(26)
0 commit comments