All problems

Northline's Biggest Single Move

easyPythonAggregation

A Northline risk analyst reviews one kind of transaction at a time, and wants the size of the single biggest movement of money of that kind — how large it was, not which direction it went in.

Transactions

id customer_id amount type txn_date
1 1 500 deposit 2023-07-01
2 1 -120 withdrawal 2023-07-03
3 2 1000 deposit 2023-07-02
4 2 -300 withdrawal 2023-07-05
5 3 250 deposit 2023-07-04
6 3 -600 withdrawal 2023-07-06
7 4 800 deposit 2023-07-07
8 4 -450 withdrawal 2023-07-08
9 5 2000 deposit 2023-07-09
10 5 -1500 withdrawal 2023-07-10
11 1 -200 transfer 2023-07-11
12 3 400 deposit 2023-07-12

Input

The transactions table above is already built for you — those rows are not read from input. What does arrive is a single line naming the kind of transaction under review, spelled exactly as the type column spells it.

Task: Print the largest amount by absolute value among transactions of that type. If no transaction carries that type, print 0.

Example: if the biggest movement of that kind had been six hundred dollars leaving an account, you'd print 600.

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…