Skip to content

Commit 331c027

Browse files
committed
Fix
1 parent 487fa33 commit 331c027

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Diff for: sorts/bead_sort.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
https://en.wikipedia.org/wiki/Bead_sort
44
"""
55

6-
from itertools import pairwise
7-
86

97
def bead_sort(sequence: list) -> list:
108
"""
@@ -33,7 +31,7 @@ def bead_sort(sequence: list) -> list:
3331
if any(not isinstance(x, int) or x < 0 for x in sequence):
3432
raise TypeError("Sequence must be list of non-negative integers")
3533
for _ in range(len(sequence)):
36-
for i, (rod_upper, rod_lower) in enumerate(pairwise(sequence)):
34+
for i, (rod_upper, rod_lower) in enumerate(zip(sequence, sequence[1:])): # noqa: RUF007
3735
if rod_upper > rod_lower:
3836
sequence[i] -= rod_upper - rod_lower
3937
sequence[i + 1] += rod_upper - rod_lower

0 commit comments

Comments
 (0)