No Overdrafts (Bank Ledger)

Now refuse any withdrawal larger than the balance: print denied: x for it and skip it. Print the final balance last.

Input: n, then n lines.

Output: denied: x lines, then the balance.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Check before subtracting.

More Bank Ledger practice