← Questions

Merge prioritized configuration tables

0
StripeCodingLast asked Apr 2026

You get several configuration tables, each a list of key=value strings with an integer priority. Merge them so that every key takes its value from the highest-priority table that sets it; between tables of equal priority, the later one wins. Then return key=value for a requested list of keys, in the order requested, skipping keys with no value.

Entries must be validated: a key is an identifier, and a value is a 32-bit signed integer written without leading zeros or a plus sign. A bad entry is ignored without affecting the rest of its table. Do it in one pass over the tables, without sorting every entry by priority.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding