Merge prioritized configuration tables
I was asked this
No reports yet. Sign in to say where you were asked it.
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.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
