Variant of LeetCode 1169. Invalid Transactions and then write a Unit Test to verify the solution.
/*
Fraud Detection: Find Suspicious Transactions
A bank wants to detect fraudulent transactions. A transaction is suspicious if:
- The same user makes two transactions within 100 seconds of each other.
- A single transaction amount exceeds $10,000.
Return a list of users who have made fraudulent transactions.
Example
Input:
transactions = [
{ "userId": "Alice", "amount": 5000, "timestamp": 10050 },
{ "userId": "Alice", "amount": 2000, "timestamp": 10200 },
{ "userId": "Bob", "amount": 12000, "timestamp": 10400 },
{ "userId": "Alice", "amount": 6000, "timestamp": 10700 }
]
Output:
["Alice", "Bob"]
*/