Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Prioritizing Bugs by Severity
00:00
5 left

Prioritizing Bugs by Severity

EasyPython

Problem

Commvault Command Center displays defects that QA engineers must review in a consistent order. Implement a function that ranks defects by severity first, impact second, and creation time third.

Formal Specification

Write prioritize_defects(defects), where defects is a list of dictionaries. Each dictionary contains:

  • id: a unique string identifying the defect
  • severity: one of "Critical", "High", "Medium", or "Low"
  • impact: one of "Widespread", "Major", "Limited", or "Minimal"
  • created_at: a non-negative integer timestamp, where a smaller value means the defect was created earlier

Return a list of defect IDs ordered by these rules:

  1. Higher severity appears first: Critical, High, Medium, Low.
  2. For equal severity, higher impact appears first: Widespread, Major, Limited, Minimal.
  3. For equal severity and impact, older defects appear first, based on smaller created_at.
  4. If all three values are equal, preserve the original input order.

Do not modify the input list or its dictionaries.

Constraints

  • 0 <= len(defects) <= 10^5
  • Every defect contains id, severity, impact, and created_at
  • severity is one of Critical, High, Medium, or Low
  • impact is one of Widespread, Major, Limited, or Minimal
  • Defect IDs are unique
  • created_at is a non-negative signed 64-bit integer

Function Signature

def prioritize_defects(defects):
Interviewer

Your question is Prioritizing Bugs by Severity. Start with the requirements in the Question tab.

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.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.