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
Task Scheduling with Block Partitioning
00:00
5 left

Task Scheduling with Block Partitioning

HardPython

Problem

Given task process times and numServer servers, each server takes a contiguous block of at least m tasks and its processing time is the sum of its m largest tasks; find the maximum possible total processing time.

Asked in the online assessment stage.

Implement maximize_processing_time(task_times, numServer, m). The input is an integer array, a positive server count, and a positive integer m. Return the maximum integer total processing time after partitioning all tasks into exactly numServer contiguous blocks, each containing at least m tasks.

Constraints

  • 2 <= len(task_times) <= 300
  • 1 <= m <= len(task_times)
  • 1 <= numServer <= len(task_times) // m
  • 0 <= task_times[i] <= 10^9
  • All tasks must belong to exactly one contiguous server block

Function Signature

def maximize_processing_time(task_times, numServer, m):
Interviewer

Your question is Task Scheduling with Block Partitioning. 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.