Validate Unique User IDs
PYTHON coding challenge · Difficulty: easy · Topic: Data Validation Pipeline · +50 XP
Problem
An ingestion job must reject a batch whose user IDs are not unique. Write validate_unique_ids(user_ids) that returns True when every ID in the list appears exactly once, and False when any ID appears more than once. An empty list has no duplicates, so it is True.
Example Input
The data below is already defined — do not redefine it.
`python
user_ids = [101, 102, 103, 104, 105]
`
Expected Output
`
True
`
Notes
- Print the result — the grader reads standard output
- Do not redefine the input; it is provided for you
- Hidden tests use other lists, including one with a repeated ID and an empty list
What this PYTHON challenge teaches you
“Validate Unique User IDs” is a easy-level PYTHON challenge focused on Data Validation Pipeline. Working through it gives you hands-on practice with hash set, uniqueness, data integrity — the kind of transformation you are asked to write in real data engineering work and in technical interviews. You can solve it directly in the browser: the dataset is pre-loaded, so you write the query or DataFrame code, run it, and compare your output against the expected result immediately.
Concepts covered
- hash set
- uniqueness
- data integrity
How to approach it
If you get stuck, work through these steps in order before looking at a full solution — each one narrows the problem down:
- Your result should return: a dictionary with:.
- Compare your output to the Expected Output — the columns and values must match. Row order is not graded; the rows themselves are, so return exactly this set and no extras.
Where this comes up
Variations of this problem have been reported in interviews at Google, Paytm, PhonePe. Interviewers use it to check whether you can express the logic cleanly and reason about correctness on edge cases such as ties, nulls and empty groups.
How to practise it on PySpark.in
Open the challenge, write your Python code in the editor and press Run to execute it against the sample dataset. Submitting checks your output against every test case, including hidden ones, so you find out straight away whether your logic holds up. You can retry as often as you like, and each solved challenge adds to your XP.
Related PYTHON challenges
- Detect Anomalies in Transaction Batches
- Word Frequency Counter
- Extract Error Codes from Log Strings
- Sum of Values by Key
- Flatten Nested JSON Structure
- Top K Frequent Elements in a Stream
Helpful resources
Frequently asked questions
Do I need to install Spark or a database to solve this?
No. The PYTHON environment runs in your browser with the sample data already loaded, so there is nothing to install or configure.
Is this challenge free?
Yes - the problem, the sample dataset, the hints and unlimited test runs are free.
What level is it?
It is rated easy and covers Data Validation Pipeline.