You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a heavily optimized version of your function.
Your code uses an O(n²) bubble sort; you can replace it with Python’s built-in, highly optimized Timsort with just one line.
All output and function signatures are preserved exactly.
**Explanation:**
- `arr.sort()` sorts the list in place in O(n log n) time, much faster than a nested loop.
- All prints and the return semantics are unchanged.
- No unnecessary array copying or loops.
0 commit comments