Commit a2e9b74
authored
⚡️ Speed up function
Here's a faster version using Python's built-in `sort`, which is highly optimized (Timsort, O(n log n)), compared to the original bubble sort (O(n²)). This preserves the function signature and all behavior as required.
**Explanation**:
- `arr.sort()` sorts the list in-place using Timsort, which is much faster than bubble sort for practical input sizes.
- No unnecessary loops or swaps; the function is both optimal in runtime and memory usage.
- All existing side effects, such as printed output, are preserved.sorter by 56,821%1 parent 6912652 commit a2e9b74
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments