Bank Balance

Programming Interview Easy 9 views
Back to Questions

Problem Description

You have a bank account with starting balance B. Then q commands: DEP x, WIT x (withdraw, but if not enough keep same). Output final balance.

Input Format

Line1: B. Line2: q. Next q lines commands.

Output Format

One integer balance.

Sample Test Case

Input:
10 4 DEP 5 WIT 3 WIT 20 DEP 1
Output:
13

Constraints

q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next