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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Dependency Chain Status Query
00:00
5 left

Dependency Chain Status Query

MediumPython

Problem

Can you explain how to build a dependency chain and query the status along that chain?

Implement the task as a function that returns every prerequisite of a target node followed by the target, with each node's status. The dependency graph is directed from a node to its immediate prerequisites, and the graph is guaranteed to be acyclic.

Input: a dependency dictionary, a status dictionary, and a target node. Output: a list of dictionaries in prerequisite-first order, each containing node and status.

Constraints

  • 1 <= number of reachable nodes <= 1000
  • The dependency graph is directed and acyclic
  • Every referenced node has an entry in statuses
  • Dependency lists contain node names represented as strings
  • The target node may have no prerequisites

Function Signature

def dependency_chain_status(dependencies, statuses, target):
Interviewer

Your question is Dependency Chain Status Query. 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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.