FastPrepMaximum Profit from Non-Overlapping Jobs
Problems/Maximum Profit from Non-Overlapping Jobs

Maximum Profit from Non-Overlapping Jobs

Google logoGoogle● HardFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report identifies maximum-profit job scheduling with start times, end times, and profits. The practice contract preserves the reported non-overlap optimization.

Job i starts at startTime[i], ends at endTime[i], and earns profit[i]. Choose a subset of non-overlapping jobs with maximum total profit.

A job that starts exactly when another selected job ends does not overlap it.

Function

maximumJobProfit(startTime: int[], endTime: int[], profit: int[]) → long

Examples

Example 1

startTime = [1,2,3,3]endTime = [3,4,5,6]profit = [50,10,40,70]return = 120

Select jobs [1,3] and [3,6].

Example 2

startTime = [1,2,3,4,6]endTime = [3,5,10,6,9]profit = [20,20,100,70,60]return = 150

The jobs spanning [1,3], [4,6], and [6,9] earn 150.

Example 3

startTime = [1]endTime = [2]profit = [7]return = 7

The only job is selected.

Constraints

  • 1 <= startTime.length == endTime.length == profit.length <= 100000.
  • 1 <= startTime[i] < endTime[i] <= 10^9.
  • 1 <= profit[i] <= 10^9.

More Google problems

  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public long maximumJobProfit(int[] startTime, int[] endTime, int[] profit) {
        // Write your solution here.
    }
}
Checking account…