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
Software Engineer Thinking and Typing Rate
00:00
5 left

Software Engineer Thinking and Typing Rate

EasyPython

Problem

While implementing a McAfee endpoint detection rule set, an engineer repeatedly prepares and types batches of code. Each batch requires dedicated thinking time before typing, and a mandatory break follows every completed typing block. Calculate how many complete lines are typed within the available work time.

For each batch, the engineer first spends think_minutes preparing exactly think_lines lines, then spends type_minutes typing those lines. After each typing block, including the final completed block, the engineer takes break_minutes before starting another batch. If time runs out during typing, count only the whole lines typed so far. If time runs out during thinking, no lines from that batch count.

Formal Specification

Implement completed_lines(total_minutes, think_minutes, think_lines, type_minutes, type_lines, break_minutes). All arguments are positive integers except that break_minutes may be zero. Return an integer representing the number of whole lines typed by the end of total_minutes.

Constraints

  • 0 <= total_minutes <= 10^9
  • 1 <= think_minutes, type_minutes <= 10^6
  • 1 <= think_lines, type_lines <= 10^9
  • 0 <= break_minutes <= 10^6
  • Count only whole typed lines

Function Signature

def completed_lines(total_minutes, think_minutes, think_lines, type_minutes, type_lines, break_minutes):
Interviewer

Your question is Software Engineer Thinking and Typing Rate. 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.