← Quiz: The Online Coding Assessment: all 10 questions
Quiz: The Online Coding Assessment · Question 4 of 10
A problem says n ≤ 10⁵. Which approach is most likely to pass in time?
A problem says n ≤ 10⁵. Which approach is most likely to pass in time?
- A.Checking every pair, O(n²)
- B.Sorting plus one pass, O(n log n)
- C.Trying every subset, O(2ⁿ)
- D.Three nested loops, O(n³)
Answer & explanation
Correct answer: Sorting plus one pass, O(n log n)
n log n is about 1.7 million steps for n = 10⁵, while n² is 10¹⁰.
Can you get the rest right without peeking?
Take the timed Quiz: The Online Coding Assessment quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →