Task Scheduling

Problem Overview

  • Compute the minimum total cost to complete all tasks given paid/free server constraints.
  • Input arrays cost[i] and time[i]; return an int for the minimum cost; n up to 1e5, cost up to 1e6, time up to 1e7.
  • Paid server runs task i with cost[i] and time[i]; free server costs 0, takes 1 unit, and can run only when the paid server is occupied.
  • Models data analysts scheduling long-running tasks on remote servers to reduce local cost.
  • Asked in Snowflake interviews; a coding interview interview question and optimization problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: