🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Approaching DSA Interview Problems: all 10 questions

Quiz: Approaching DSA Interview Problems · Question 10 of 10

In the marks example, what made the O(n + q) solution possible?

In the marks example, what made the O(n + q) solution possible?

  1. A.The number of questions was small
  2. B.Python's built-in sort
  3. C.Using recursion
  4. D.Marks were whole numbers in a small range (0 to 100), so a counting array fits
Answer & explanation

Correct answer: Marks were whole numbers in a small range (0 to 100), so a counting array fits

Reading the value range, not only n, unlocked counting plus prefix sums.

Can you get the rest right without peeking?

Take the timed Quiz: Approaching DSA Interview Problems quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →