
N = 3
TRANSACTIONS = [(1,20,100,1),(2,30,24,1),(1,60,90,2)] [For the first transaction, customer_id is 1, the time of transaction is 20 minutes, the amount of transaction is Rs 100 and the city code where the transaction took place is 1, so the tuples are in the form (customer_id, time_fo_transaction, amount_of_transaction, city_code)].
ANSWER:- The invalid transactions are [(1,20,100,1),(1,60,90,2)] as the transactions are under the same customer id and have occurred in different cities within 60 minutes
The first line contains a single integer ‘T’ representing the number of test cases. Then each test case follows.
The first line of every test case contains an integer ‘N’ denoting the number of transactions.
The next ‘N’ lines of every test case contain four integers ‘CUST_ID’, ‘TIME’, ‘AMOUNT’, ‘CITY’ denoting the customer id, time of the transaction, amount of transaction, and the city code of transaction respectively of the ith transaction.
For each test case, return the invalid transactions from the list of transactions.
The output of each test case should be printed in a separate line.
You are not required to print anything, it has already been taken care of. Just implement the function.
1 <= T <= 10
1 <= N <= 10^3
1 <= CUST_ID <=10^9
1 <= TIME <= 10^9
1 <= AMOUNT <= 10^9
1 <= CITY <= 10^9
Time Limit = 1 sec
Check if a transaction is valid by comparing it with all other transactions and if it’s invalid, add the transaction to the answer.
For every pair of customer_id and time of the transaction, store the city in which the transaction occurs. After that check whether any transaction occurs within 60 mins in a different city with the same customer name.