Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Software Engineer Thinking and Typing Rate

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

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

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):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output