Time Complexity · #53 · 2026-05-27
What's the Big-O?
JavaScript ·Difficulty 2/3
How to play
Read the code and pick its time complexity from four Big-O choices. Think about loops, recursion, and hidden costs. Press 1–4 or click to answer.
What is the time complexity of mergeSort?
function mergeSort(arr) {
if (arr.length <= 1) return arr;
const mid = Math.floor(arr.length / 2);
const left = mergeSort(arr.slice(0, mid));
const right = mergeSort(arr.slice(mid));
return merge(left, right);
}
Loading your progress...
Press 1 through 4, or tap a numbered choice, to answer. Back to hub