Extend rules for trip-level aggregates and outputs
RipplingSoftware Engineer · Technical ScreenLast updated
This interview question evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer for Extend rules for trip-level aggregates and outputs states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Extend the same system to support aggregate trip‑level rules. Implement handling for rules like: (
- A trip’s total expenses cannot exceed $2000; (
- Total meal expenses per trip cannot exceed $200. In the provided sample, trip "002" violates both rules. Update the design and the evaluateRules return type so the output includes per‑trip violations alongside per‑expense violations. Describe grouping/aggregation strategy, evaluation order, explainability for aggregates, performance considerations, and how these results integrate into the expenses API used by many companies.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.