Skip to content

Commit 9a53b54

Browse files
authored
Update minimum-swaps-to-group-all-1s-together-ii.py
1 parent d696285 commit 9a53b54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/minimum-swaps-to-group-all-1s-together-ii.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def minSwaps(self, nums):
88
:rtype: int
99
"""
1010
result = cnt = w = nums.count(1)
11-
for i in xrange(len(nums)*2):
11+
for i in xrange(len(nums)+(w-1)):
1212
if i >= w:
1313
cnt += nums[(i-w)%len(nums)]
1414
cnt -= nums[i%len(nums)]

0 commit comments

Comments
 (0)