← back to unit
Medium
# power tools medium
The Lonely Number
Every dance move was performed twice — except one, done only once. Find the loner. 🕺
You get the nums where every value appears exactly twice except one value appearing once. Print the lonely value.
Example:
Input: nums = [7, 3, 7, 9, 3]
Output: 9
Tallying gives 7→2, 3→2, 9→1 — only 9 appears exactly once.
💡 need a hint?
pt-lonely-number.py🔒 given lines are locked — write your code in between
loading...