Commit 98121d0
authored
⚡️ Speed up function
Here’s the optimized rewrite, switching from O(N²) inefficient bubble sort to fast built-in Timsort (used by Python’s sort).
All logic and output are preserved.
No changes to function signature or variable names.
The entire nested loop is replaced with `arr.sort()`, which is much faster and more memory-efficient for all list sizes.sorter by 151,054%1 parent f4c6c7d commit 98121d0
1 file changed
+1
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 3 | + | |
9 | 4 | | |
10 | 5 | | |
0 commit comments