Diff Feature Definitions Between Two Deployment Branches
Last updated: November 29, 2026
Quick Overview
Given the feature definitions on main and on a branch, each a map from feature name to its attributes (type, resolver, staleness and so on), report which features were added, removed, or changed, and for changed ones which attributes differ.
Chalk
November 29, 20260
0
0 solved
Given the feature definitions on main and on a branch, each a map from feature name to its attributes (type, resolver, staleness and so on), report which features were added, removed, or changed, and for changed ones which attributes differ.
Chalk deploys feature changes to branches so a data scientist can test a new resolver before promoting it, and the dashboard needs a readable summary of what a branch changes. This warm-up checks set operations, careful handling of attributes present on only one side, and deterministic output.
What the Interviewer Expects
- Uses set difference for added and removed features
- Compares the union of attribute keys so a removed attribute counts as a change
- Omits unchanged features from the changed section
- Sorts output for stable, testable results
- Mentions complexity linear in total attributes
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you diff nested attributes such as a resolver's input list, showing items added and removed?
- If a feature was renamed, how could you detect it as a rename rather than one removal plus one addition?
- How would you flag which changes are breaking for models already reading the feature?
- How would you render this diff in a React component for large branches?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs main and branch: name -> {attr: value}. Output {'added': [...], 'removed': [...], 'changed': {name: [attrs]}}, all sorted. An attribute missing on one side and present on the other is a...
High-Level Design
Added = branch keys minus main keys, removed = main keys minus branch keys. For the intersection, take the union of attribute names and keep those whose values differ using dict.get, which treats mi...