Company: Fundwave
Difficulty: medium
Expense Manager: First Successful Installment Date Dinesh borrowed a huge sum from Gilfoyle to buy himself a brand new Tesla, and he agreed to pay it back in periodic installments. To be extra sure he actually gets paid, Gilfoyle sets up an automatic deduction system. On every installment check date the system looks at Dinesh's account balance and deducts the installment amount if the balance is large enough . Dinesh's account is driven entirely by recurring transactions . Each transaction has a first occurrence date, a positive amount, a repeat frequency, and a type: a CREDIT adds its amount to the balance, a DEBIT subtracts it. Every transaction repeats forever at its own frequency, starting from its own first occurrence date. The account starts empty, with a balance of 0 . Given all of Dinesh's recurring transactions and the loan schedule, report the first installment check date on which the deduction can go through . Rules The balance starts at 0 . A transaction with first-occurren