Dsa
Hashing
Medium
Find Duplicate Transactions
A bank keeps track of customer transactions, and you need to find out which transactions are duplicated. Each transaction is represented as a string in the format 'ID:amount'. Return the IDs of transactions that appear more than once in the input.
Input:
A single line containing space-separated transaction strings.
Output:
A list of IDs that have duplicate transactions, sorted in ascending order.
Example:
Input:
'1:50 2:30 1:50 3:80 2:30'
Output:
['1', '2']
Key concepts
hashingtransactionscounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now