Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Deduplicate Automated Test Results

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Deduplicate Automated Test Results. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given a list of test execution records, return the final unique failures after deduplication. Each record is a dictionary with keys test_id, status, timestamp, and message. Keep only records where status == "FAIL", and if the same test_id appears multiple times as a failure, keep only the most recent one by timestamp. Return the result sorted by ascending test_id.

Constraints

  • 1 <= len(records) <= 10^5
  • records[i] contains keys: test_id, status, timestamp, message
  • test_id and status are strings
  • 0 <= timestamp <= 10^9
  • status is one of "PASS", "FAIL", "SKIP"

Function Signature

def deduplicate_failures(records):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output