Back to problems

Aggregate expenses by person, trip, and category

Algorithm · Rippling · Medium

You are given a collection of expense entries. Each entry contains four values: employee_id: a string identifying the employee trip_id: a string identifying the trip category: a string such as FOOD, LODGING, or TRAVEL amount: a non-negative integer Implement the following aggregation functions: totalByEmployee(records) — returns a dictionary whose keys are employee IDs and whose values are the sum of all amount fields for that employee. totalByTripForEmployee(records,…

Checking your access…