1169. Invalid Transactions Medium
1/**
2 * [1169] Invalid Transactions
3 *
4 * A transaction is possibly invalid if:
5 *
6 * the amount exceeds $1000, or;
7 * if it occurs within (and including) 60 minutes of another transaction with the same name in a different city.
8 *
9 * You are given an array of strings transaction where transactions[i] consists of comma-separated values representing the name, time (in minutes), amount, and city of the transaction.
10 * Return a list of transactions that are possibly invalid. You may return the answer in any order.
11 *
12 * Example 1:
13 *
14 * Input: transactions = ["alice,20,800,mtv","alice,50,100,beijing"]
15 * Output: ["alice,20,800,mtv","alice,50,100,beijing"]
16 * Explanation: The first transaction is invalid because the second transaction occurs within a difference of 60 minutes, have the same name and is in a different city. Similarly the second one is invalid too.
17 * Example 2:
18 *
19 * Input: transactions = ["alice,20,800,mtv","alice,50,1200,mtv"]
20 * Output: ["alice,50,1200,mtv"]
21 *
22 * Example 3:
23 *
24 * Input: transactions = ["alice,20,800,mtv","bob,50,1200,mtv"]
25 * Output: ["bob,50,1200,mtv"]
26 *
27 *
28 * Constraints:
29 *
30 * transactions.length <= 1000
31 * Each transactions[i] takes the form "{name},{time},{amount},{city}"
32 * Each {name} and {city} consist of lowercase English letters, and have lengths between 1 and 10.
33 * Each {time} consist of digits, and represent an integer between 0 and 1000.
34 * Each {amount} consist of digits, and represent an integer between 0 and 2000.
35 *
36 */
37pub struct Solution {}
38
39// problem: https://leetcode.com/problems/invalid-transactions/
40// discuss: https://leetcode.com/problems/invalid-transactions/discuss/?currentPage=1&orderBy=most_votes&query=
41
42// submission codes start here
43
44impl Solution {
45 pub fn invalid_transactions(transactions: Vec<String>) -> Vec<String> {
46 vec![]
47 }
48}
49
50// submission codes end
51
52#[cfg(test)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn test_1169() {
58 }
59}
60
Back
© 2025 bowen.ge All Rights Reserved.