# Invalid Transactions (Leetcode 1169)

Problem Link: <https://leetcode.com/problems/invalid-transactions/>

```python
class Solution:
    def invalidTransactions(self, transactions: List[str]) -> List[str]:
        
        n=len(transactions)
        name=[]
        time=[]
        amount=[]
        city=[]
        invalid=[False for i in range(n)]
        ans=[]
        for i in range(n):
            temp=list(map(str,transactions[i].split(',')))
            name.append(temp[0])
            time.append(int(temp[1]))
            amount.append(int(temp[2]))
            city.append(temp[3])
        
        for i in range(n):
            
            if(amount[i]>1000):
                invalid[i]=True
            
            for j in range(i+1,n):
                if(amount[j]>1000):
                    invalid[j]=True
                if(name[i]==name[j] and city[i]!=city[j] and abs(time[i]-time[j])<=60):
                    invalid[i]=True
                    invalid[j]=True
        
        for i in range(n):
            if(invalid[i]==True):
                ans.append(transactions[i])
        
        return ans
```
