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
Git Workflow and Code Reviews
00:00
5 left

Git Workflow and Code Reviews

MediumPython

Problem

Can you explain how you utilize Git for version control, branching strategies, and collaborative code reviews? Implement validate_git_workflow(events) to validate an ordered Git workflow. Return the zero-based indices of invalid events. A feature branch must be created from main, commits must target existing branches, an approved review must reference the branch's latest commit, and a merge into main requires that approval. Each event is a dictionary with a type field and relevant fields described by the examples.

Constraints

  • 0 <= events.length <= 100
  • Each event is a dictionary with a valid JSON-compatible shape.
  • Branch names and commit identifiers are non-empty strings.
  • Event order represents the order in which Git operations occurred.
  • Return invalid event indices in ascending order.

Function Signature

def validate_git_workflow(events):
Interviewer

Your question is Git Workflow and Code Reviews. 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.