🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Checking every pair, O(n²)
  2. B.Sorting plus one pass, O(n log n)
  3. C.Trying every subset, O(2ⁿ)
  4. 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 →