Skip to content

Commit c1994c0

Browse files
Update cyclic_sort.py
1 parent 06fcd14 commit c1994c0

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

sorts/cyclic_sort.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ def cyclic_sort(nums: list) -> list:
2424
[1, 2, 3, 4, 5]
2525
>>> cyclic_sort([])
2626
[]
27-
>>> cyclic_sort([-2, -5, -45])
28-
[-45, -5, -2]
2927
"""
3028

3129
# Perform cyclic sort
3230
i = 0
3331
while i < len(nums):
3432
# Calculate the correct index for the current element
3533
correct_index = nums[i] - 1
36-
3734
# If the current element is not at its correct position,
3835
# swap it with the element at its correct index
3936
if nums[i] != nums[correct_index]:

0 commit comments

Comments
 (0)