SpinTheMic
Pro

Interview practice question

Checking membership in a list is slow

Backend Engineering · Language Runtimes · Beginner

An endpoint checks whether each of 50,000 incoming IDs exists in a list of 100,000 allowed IDs, and it takes seconds. How do you speed it up?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • List lookup is O(n); nested loop O(n×m).
  • Use hash set for O(1) lookups.
  • Build set once, reuse.
  • Or let database do the join.
  • Know data structure complexity.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics