← 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?
- A.The number of questions was small
- B.Python's built-in sort
- C.Using recursion
- 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 →