Test Cases
Case 1
Case 2
Input
[1, 2, 3, 3], [3, 4, 5, 6], [50, 10, 40, 70]
Output
120
You are given n jobs where each job is represented by three elements: start time
, end time
, and profit
it earns. Each job is independent of the others, and you can only work on one job at a time. The jobs may overlap, and you can choose not to take a job. Your task is to find the maximum profit you can earn by scheduling your time optimally.
Write a function that takes three arrays: startTime
, endTime
, and profit
, all of the same length, where the i-th job can be started at startTime[i] and will end at endTime[i], earning profit[i] profit.
Example 1
Input: [1, 2, 3, 3], [3, 4, 5, 6], [50, 10, 40, 70]
Output: 120
Example 2
Input: [1], [2], [100]
Output: 100
Input
Output