Algorithms·medium 18 min 75 XP
Bubble Sort
Implement bubble sort: repeatedly swap adjacent out-of-order elements until the array is sorted ascending.
Examples
- bubbleSort([5,3,1,4]) → [1,3,4,5]
Constraints
- Keep the required function name so the tests can find it
- Return a value instead of only logging it
- Do not mutate inputs unless the challenge asks you to
Bubble Sort · editor
Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.