Commit 3389e52
authored
⚡️ Speed up function
Here is an optimized version of your program. The original implements a naive bubble sort, which is very slow (O(n²)). To make it run much faster, replace the sort logic with Python's built-in `sort` (timsort, O(n log n)). The function signature, return value, and print statements are unchanged.
This is the fastest and most memory-efficient way to sort a list in Python 3.12.10 while preserving existing comments and functionality.sorter by 208,818%1 parent 2ad1029 commit 3389e52
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