Trains the technique from
LeetCode 1169Invalid TransactionsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
An audit tool receives a day's expense claims as a list of strings. Each entry of transactions has the form "{staff},{minute},{amount},{site}", giving the person who filed it, the minute of the day it was filed, the sum claimed, and the office site it was filed from.
A claim is flagged when either of these holds:
1200, orstaff name, was filed from a different site, and its minute is within 60 of this claim's minute (a gap of exactly 60 counts as within).Return the flagged claims as the original strings, in any order. Two entries may be byte-for-byte identical; each is judged separately, so each flagged copy appears in the result.
Example 1
Dana's two claims are 60 minutes apart from different sites, which is within the window, so both are flagged. Elias claims 1300, which is above 1200.
Example 2
Both claims come from the same site, so the second rule does not apply, and neither amount is above 1200.
Example 3
The two entries are identical and each claims 1500, so each one is flagged on the amount rule and both copies are reported.
The values you return may be in any order.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def invalid_transactions(transactions: list[str]) -> list[str]:public List<String> invalidTransactions(String[] transactions)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.