Implement CRUD operations for configuration records containing key-value pairs and a priority. Listing the effective configuration must resolve duplicate keys by taking the value from the highest-priority record, rather than merely printing high-priority records first.
### Constraints & Assumptions
Use explicit practice assumptions for unspecified API details: each record has a unique ID; create rejects an existing ID; update replaces the record's key-value map and priority; delete rejects a missing ID. Larger numeric priority wins. Equal-priority conflicting values are rejected during effective listing rather than resolved arbitrarily. Output keys may be sorted for deterministic display.
### Clarifying Questions to Ask
- Does priority belong to a configuration record or to each key-value entry?
- What should happen when equal-priority records disagree on a value?
- Is update a full replacement or a patch?
```hint Resolve each key independently
A high-priority record may override one key while lower-priority records still supply other keys.
```
### What a Strong Answer Covers
- CRUD validation and avoiding aliasing mutable input maps.
- Per-key winner selection across all records.
- A defined equal-priority conflict policy and deterministic output.
### Follow-up Questions
- How would deleting a winning record reveal the next-highest-priority value?
- Which index would accelerate repeated listings when updates are rare?
Overview: Implement configuration CRUD with per-key priority overrides, deterministic conflict handling, defensive copies, and correct fallback after deleting winners.
Implement CRUD operations for configuration records containing key-value pairs and a priority. Listing the effective configuration must resolve duplicate keys by taking the value from the highest-priority record, rather than merely printing high-priority records first.
Constraints & Assumptions
Use explicit practice assumptions for unspecified API details: each record has a unique ID; create rejects an existing ID; update replaces the record's key-value map and priority; delete rejects a missing ID. Larger numeric priority wins. Equal-priority conflicting values are rejected during effective listing rather than resolved arbitrarily. Output keys may be sorted for deterministic display.
Clarifying Questions to Ask Guidance
Does priority belong to a configuration record or to each key-value entry?
What should happen when equal-priority records disagree on a value?
Is update a full replacement or a patch?
What a Strong Answer Covers Guidance
CRUD validation and avoiding aliasing mutable input maps.
Per-key winner selection across all records.
A defined equal-priority conflict policy and deterministic output.
Follow-up Questions Guidance
How would deleting a winning record reveal the next-highest-priority value?
Which index would accelerate repeated listings when updates are rare?