Skip to content

Practice Invalid Transactions

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#1169
LeetCode Problem

Invalid Transactions

Problem Statement

Each transactions[i] is a comma-separated string containing a name, a time in minutes, an amount, and a city. A transaction is possibly invalid if its amount exceeds 1000, or if another transaction with the same name occurs in a different city within 60 minutes, including exactly 60 minutes. Return every possibly invalid transaction in any order.

Source: Invalid Transactions on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
transactions = ["alice,20,800,mtv","alice,50,100,beijing"]
Output
["alice,20,800,mtv","alice,50,100,beijing"]

# Example 2

Input
transactions = ["alice,20,800,mtv","alice,50,1200,mtv"]
Output
["alice,50,1200,mtv"]

# Example 3

Input
transactions = ["alice,20,800,mtv","bob,50,1200,mtv"]
Output
["bob,50,1200,mtv"]

Constraints

transactions.length <= 1000
Each transactions[i] takes the form "{name},{time},{amount},{city}"
Each {name} and {city} consist of lowercase English letters, and have lengths between 1 and 10.
Each {time} consist of digits, and represent an integer between 0 and 1000.
Each {amount} consist of digits, and represent an integer between 0 and 2000.

Related LeetCode Problems

Practice more problems similar to Invalid Transactions.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.