The idea
The practically important case is the accidental O(n²): a nested includes or indexOf inside a loop over the same data. Recognising that pattern is worth more than being able to recite the definition.
Lesson
No lesson built yet. The worked solutions below are the material it would be assembled from.
Questions (3)
| Question | Type | Difficulty | Drift | Accuracy |
|---|---|---|---|---|
| What is the time complexity of looking up a key in a JavaScript Map? | mcq | Moderate 0.10 | — | — (0) |
| What is the complexity of this? function dedupe(arr) { const out = []; for (const x of arr) { if (!ou… | mcq | Hard 0.80 | — | — (0) |
| An O(n²) algorithm runs in 1 second on 1,000 items. Roughly how long on 10,000? And why might the O(n²) versio… | short | Hard 1.40 | — | — (0) |