Filter Invalid Expenses Based on Rules
Implement a function that takes a list of expenses and validation rules, then returns only the expenses that violate the given rules. Design the solution to be extensible for adding new validation rules.
Asked at:
Rippling
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid June, 2026
Rippling
Mid-level
Late February, 2026
Rippling
Mid-level
Given a list of expenses, return the invalid expenses. The method takes in expenses and rules. You can define the rules as you prefer and consider how new rules can be added. Sample rules: No restaurant order should exceed $20. No airfare is valid. No entertainment expense is valid. [ { "vendor_type": "restaurant", "amount_usd": 49.99 }, { "vendor_type": "airfare", "amount_usd": 29 }, { "vendor_type": "entertainment", "amount_usd": 30 }, { "vendor_type": "other", "amount_usd": 49.99 } ] implement evaluate(rules, expenses)
Hello Interview Premium
Your account is free and you can post anonymously if you choose.