DeepInterview

Weighted Job Scheduling for Maximum Profit Without Overlaps

Coding2026/04

Description

Given a set of jobs, where each job has a start time, end time, and profit, find the maximum profit you can achieve without overlapping. You may choose not to do any job. The constraint is that the number of jobs does not exceed 50000. Implement an efficient algorithm to solve this problem. Here’s an example:

Input: startTime = [1, 2, 3, 3], endTime = [3, 4, 5, 6], profit = [50, 10, 40, 70]
Output: 120
Explanation: Select jobs 1 and 4 for a total profit of 120.

Starter Code

def solution():
    # Read data from standard input
    # Write your code here
    pass
if __name__ == "__main__":
    solution()

Discussion (0)

All comments are anonymous. Your identity is not shared.
Loading comments...
Loading editor…
OUTPUTLast run results appear here.
No output yet. Click "Run Code" to see results.