Company: Paytm_14_jan
Difficulty: medium
Bank Transactions Problem Description An account holder at a bank wants to make n transactions in a day. Each transaction represents either sending money (negative amount) or receiving money (positive amount). Transactions occur in order, but some may be skipped. The balance starts at 0 and must never go negative. Determine the maximum number of transactions possible from the given sequence. Example: transaction = [3, 2, -5, -6, -1, 4] One optimal solution is to perform transactions 1, 2, 3, and 6: Start with balance = 0 Transaction 1: 0 + 3 = 3 Transaction 2: 3 + 2 = 5 Transaction 3: 5 + (-5) = 0 Transaction 6: 0 + 4 = 4 The maximum number of transactions possible is 4. Function Description Complete the function maximizeTransactions in the editor with the following parameter(s): int transaction[n] : the transaction amounts Returns int : the maximum number of transactions possible Constraints 1 ≤ n ≤ 2000 -10 9 ≤ transaction[i] ≤ 10 9 , 0 ≤ i Examples Example 1: Input: t