Your question is Functional Stream Processing. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
SberPay receives a collection of payment operations. Build a functional processing pipeline that keeps only completed operations meeting an amount threshold and belonging to an allowed category, then transforms and ranks the results.
Implement process_operations(operations, min_amount, allowed_categories).
operations is a list of dictionaries. Each dictionary contains:
id: a unique stringamount: a non-negative numberstatus: a string such as "completed" or "declined"category: a stringmin_amount is a non-negative number. The threshold is inclusive.allowed_categories is a list of strings.id, amount, and category.status == "completed", amount >= min_amount, and category is allowed.amount. For equal amounts, sort by increasing id.filter, map, and sorted.def process_operations(operations, min_amount, allowed_categories):