SpinTheMic
Pro

Interview practice question

Flattening nested lists of IDs

Data Engineering · Python · Beginner

An API returns a list of pages, each containing a list of IDs. How do you get a single flat list of unique IDs?

What a strong answer covers

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

  • Use a nested comprehension or itertools.chain.
  • Convert to a set to remove duplicates.
  • Sort if order matters, since sets are unordered.
  • For huge data, stream instead of building lists.
  • Keep count before and after for logging.
Practise this topic

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

See all topics