← 返回 ramp 的题目列表Identify Recurring Transactions
类型:online_judge
Given a list of transactions, each transaction contains the transaction date, merchant, amount, and currency. Identify the recurring transactions and print the merchant and amount, e.g., 'Netflix, $30 per month'. You need to distinguish between daily, weekly, monthly, etc., recurrences.
Input
A list of transactions. Each transaction includes transaction_date, merchant, amount, currency.
Output
Print identified recurring transactions in format merchant, amount.
Challenges
The same merchant might have multiple non-recurring transactions.
Sample Input
transaction_date, merchant, amount, currency
2023-01-01, Netflix, 30, USD
2023-02-01, Netflix, 30, USD
2023-03-01, Netflix, 30, USD
2023-01-02, Bus, 2, USD
2023-01-08, Bus, 2, USD
Sample Output
Netflix, $30 per month
Note
Implement a method to differentiate recurring and non-recurring transactions, particularly identifying small non-recurring ones.
Example
Input
2023-01-01, Netflix, 30, USD
2023-02-01, Netflix, 30, USD
2023-03-01, Netflix, 30, USD
2023-01-02, Bus, 2, USD
2023-01-08, Bus, 2, USD