Python
All Top 50 Python & Pandas Interview Questions#10
Find Duplicate Items in a List in O(N) Time in Python
EasyInterview Question #10
Given a list of customer IDs, find all IDs that appear more than once. Return the duplicates in deterministic sorted order.
Input Table: customer_ids
1 rows preview| id_list |
|---|
| 10,20,30,20,40,10,50 |
Expected Output Structure1 rows
| duplicate_ids |
|---|
| 10,20 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Python 3.10 (Pandas)
Environment Ready
Click "Run & Test" to execute your Pandas code against the test assertions.