Skip to content

Commit a27150c

Browse files
authored
Apply batched suggestions from code review
Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent 79c13f4 commit a27150c

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

‎sorts/pancake_sort.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ def pancake_sort[T: Comparable](arr: Sequence[T]) -> list[T]:
6464
while cur > 1:
6565
# Find the index of maximum element in arr[0:cur]
6666
max_index = arr.index(max(arr[:cur]))
67-
6867
# Move maximum element to end of current unsorted portion:
6968
# 1. Flip to bring max to the beginning
7069
arr[: max_index + 1] = reversed(arr[: max_index + 1])
7170
# 2. Flip to send max to position cur-1
7271
arr[:cur] = reversed(arr[:cur])
73-
7472
cur -= 1
7573
return arr
7674

0 commit comments

Comments
 (0)