🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Reviewing AI Code: all 10 questions

Quiz: Reviewing AI Code · Question 5 of 10

Which change fixes the slow duplicate check in Bug 6?

Which change fixes the slow duplicate check in Bug 6?

  1. A.Use a longer list
  2. B.Convert the registered list to a set before checking membership
  3. C.Add time.sleep
  4. D.Sort incoming
Answer & explanation

Correct answer: Convert the registered list to a set before checking membership

Set membership is O(1) on average, list membership is O(n).

Can you get the rest right without peeking?

Take the timed Quiz: Reviewing AI Code quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →