← 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?
- A.Use a longer list
- B.Convert the registered list to a set before checking membership
- C.Add time.sleep
- 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 →