The Invalid Transactions interview question asks you to identify transactions from a list that are potentially fraudulent. A transaction is "invalid" if:
Companies like Bloomberg, PayPal, and Microsoft ask this to test your ability to handle data cleaning and multi-condition filtering. It evaluations whether you can use Hash Table interview patterns to group data and then apply a sliding-window or range-check logic to find conflicts. It’s a highly practical, real-world scenario.
This is a Data Grouping and Verification problem.
name, time, amount, city.name.amount > 1000, mark it invalid.|T1.time - T2.time| <= 60 and T1.city != T2.city, mark BOTH as invalid.["alice,20,800,mtv", "alice,50,100,beijing"]
Always look for the "All-Pairs" vs. "Sliding Window" distinction. If the window is small (60 minutes) but many transactions can happen within it, a simple nested loop over the transactions of the same person is often efficient enough given the constraints.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Sort Features by Popularity | Medium | Solve | |
| High-Access Employees | Medium | Solve | |
| Group Anagrams | Medium | Solve | |
| Alert Using Same Key-Card Three or More Times in a One Hour Period | Medium | Solve | |
| Before and After Puzzle | Medium | Solve |