Python
All Top 50 Python & Pandas Interview Questions#6
Fast Deduplication and Set Operations in Python
EasyInterview Question #6
Given two lists of customer IDs representing visitors to Campaign A and Campaign B, find all customers who visited both campaigns. Explain the time complexity versus nested loops.
Input Table: campaigns
1 rows preview| campaign_a | campaign_b |
|---|---|
| 101,102,103,104 | 103,104,105,106 |
Expected Output Structure1 rows
| both_campaigns |
|---|
| 103,104 |
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.