Three easy problems the way a fintech interview frames them: exact money, events in order, and requests that arrive twice. A 50-minute round with a plan.
A fintech company moves money: payments, transfers, cards, wallets and ledgers. Its coding interviews use the same data structures as any other company, but the stories are about money, and the interviewer listens for four habits.
The warm-up round tests these habits on three easy problems. Interviewers expect clean, correct code and clear questions more than speed. They often start with "What would you ask before writing code?" Have your questions ready: the unit, the sign, the order of events and what counts as a repeat.
This is the first of three rounds in the fintech set. The core and stretch rounds that follow use the same habits on harder problems: windows of exposure, ledgers to reconcile and routes across payment networks.
Exercise · Predict the output: Repeats measured from the latest. Four transfers have the same sender, receiver and amount. A transfer is a repeat when it comes at most 60 seconds after the latest earlier one with the same key. How many repeats does this count?
times = [0, 50, 100, 170]
window = 60
latest = None
repeats = 0
for t in times:
if latest is not None and t - latest <= window:
repeats += 1
latest = t
print(repeats)Each problem names its move in the statement. Read the signal, then use the idea the Academy already taught you.
| Signal in the statement | The move | Academy lesson |
|---|---|---|
| the balance must never go below zero | a running total and its lowest point, in 64 bits | Prefix sums in 1D and 2D |
| the same sender, receiver and amount, soon after | a seen-map from a three-field key to its latest time | Seen-set and complement |
| the oldest unmatched payment first | a map from each customer and amount to a queue | Queues and deques |
What is new here is the frame, not the idea. The key has several fields, and leaving one out makes two different payments look the same. The time window is measured from the latest event, not the first. And "oldest first" is a promise to finance, so a stack would break it.
The balance problem looks easy, and that is the trap. The lowest point must start at zero, because the balance before the first entry counts too.
Exercise · Find the bug: The opening balance below zero. This returns the smallest opening balance that keeps the running balance at zero or above. It is right whenever the balance dips below zero, but wrong when it never does. Which line is wrong?
def smallest_opening_balance(entries):
running = 0
lowest = entries[0]
for amount in entries:
running += amount
lowest = min(lowest, running)
return -lowestA repeat is measured from the latest transfer with its key, so store the time at every transfer, repeat or not.
Refunds are the last move. A stack hands out the newest payment, which matches the right amount but the wrong payment.
Exercise · Break it: Refunds that take the newest payment. This matches each refund (kind 1) to an earlier payment (kind 0) of the same customer and amount, or -1. It keeps a stack for each key, so it takes the newest payment. Find an input where the result breaks the oldest-first rule.
def match_refunds(kinds, customers, amounts):
waiting = {}
matches = []
for i in range(len(kinds)):
key = (customers[i], amounts[i])
if kinds[i] == 0:
waiting.setdefault(key, []).append(i)
else:
stack = waiting.get(key)
matches.append(stack.pop() if stack else -1)
return matchesA stack gives a refund the newest payment; the count of matches looks right, but the links break the oldest-first rule.
All three problems are easy, and together they make one warm-up round. Each time box is close to what an interviewer allows for an easy problem, with time to explain.
Solve them in this order. The first is a single pass with two numbers, the second adds a map, and the third adds a queue inside the map.
A warm-up problem rarely ends at the first answer. Once your code works, the interviewer changes one rule and asks what changes in your code. Prepare one follow-up for each problem.
Treat the three problems as one interview: 50 minutes in all, with a timer. Work out loud, as if someone is listening.
If a problem takes longer than its box, finish it anyway, but note the overrun. In a real round the interviewer would have moved on, so the next attempt should be faster.
Checkpoint · Fintech warm-up round
Q1/5 How should a fintech solution store an amount of money?
Answer: B
Floating point cannot hold most decimal amounts exactly. A whole number of a minor unit is exact, and a 64-bit total holds a day of payments.
Q2/5 The entries are 100, 250 and -50. What is the smallest opening balance that keeps the balance at zero or above?
Answer: B
The running balance is 100, 350 and 300, so it never dips below zero. The lowest point starts at 0, so the answer is 0, not minus the first entry.
Q3/5 Two transfers go from user 1 to user 2, 10 seconds apart, of 50 and 70 units. Is the second a repeat?
Answer: B
A repeat needs the same sender, receiver and amount. A key without the amount makes two different payments look like one.
Q4/5 Transfers with one key arrive at seconds 0, 50, 100 and 170, and the window is 60. How many are repeats?
Answer: B
Measured from the latest earlier transfer, the gaps are 50, 50 and 70, so two are repeats. Measuring from the first transfer gives only 1.
Q5/5 A customer pays 5 units twice, then asks for one refund of 5 units. Which payment does the refund take?
Answer: A
The rule is first in, first out, so finance can trace every refund to one payment. A stack would take the newest payment instead.
Review cards from this lesson.
A few questions, then explain the idea back in your own words. Your tutor marks it. Quiz and explain back.