Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Debugging a Frontend Codebase

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

Your question is Debugging a Frontend Codebase. 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

You’ll be given a silly question to debug something in their codebase, and you need to explain what to do to another engineer sharing your screen while you debug something like an interface implemented by dozens of classes with different overrides; how would you approach that debugging and communication?

Implement debug_overrides(implementations, expected) to trace each class's effective method result, identify classes whose result violates the interface contract, and report the first faulty override on each inheritance path. Preserve the input order of classes in the output.

Each implementation has name, parent, and override; parent is null for roots, and override is null when the class inherits its parent's result. Return diagnostic objects containing class, path, culprit, and observed.

Constraints

  • 1 <= implementations.length <= 1000
  • Each name is unique and each non-null parent names another implementation
  • The inheritance relationships form a forest with no cycles
  • Each override and expected value is a non-null string or null
  • null override means the class inherits its parent's effective result
  • Return reports in deterministic input order

Function Signature

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