One UTF-8 JSON value matching the structures shown in the examples.
Practice Mode • SQL & Data • easy
Latest Credential Version
Deduplicate credentials to their latest version.
Problem
You are implementing deduplicate credentials to their latest version. The input is one JSON value. Return exactly the JSON or scalar result described by the examples, with stable ordering and no extra logging. Deduplicate records by key, retaining the latest stable winner. Explain your reasoning and complexity during interview review; the judge evaluates only the returned result.
One deterministic JSON value or scalar with no explanatory text.
Partition/rank by key and descending time
sql-fixture-json-v1
Examples
Input: {"key":"entity","rows":[{"entity":"a","id":1,"time":1,"value":"old"},{"entity":"a","id":2,"time":2,"value":"new"},{"entity":"b","id":3,"time":1,"value":2}],"time":"time"}
Output: [{"entity":"a","id":2,"time":2,"value":"new"},{"entity":"b","id":3,"time":1,"value":2}]This example demonstrates the core sql data invariant.
Input: {"key":"entity","rows":[],"time":"time"}
Output: []This example covers the empty or minimum boundary.
Constraints
- Input is valid UTF-8 JSON and is at most 64 KB.
- Output must be deterministic for identical input.
- Do not use network access, persistent filesystem writes, subprocesses, or environment secrets.
- Handle the empty or minimum boundary shown in the examples.
Progressive hints
Sign in to reveal hints one at a time.
Integrity: hidden tests, editorial solutions, and assessment-only cases are never sent to the browser as answer keys. Final execution occurs only in the separately isolated runner.
Execution unavailable until runner deployment and certificationdisabled • pending
Sign in to code
You can review the complete problem publicly. Sign in to save encrypted drafts and submit to the isolated runner.
Sign in