We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34c7ecd commit 6b73c38Copy full SHA for 6b73c38
dynamic_programming/job_scheduling.py
@@ -17,7 +17,7 @@ def job_scheduling(jobs):
17
250
18
"""
19
# Sort jobs by end time
20
- jobs.sort(key=lambda x: x[1])
+ jobs = sorted(jobs, key=lambda x: x[1])
21
n = len(jobs)
22
# dp[i] stores max profit including jobs[i]
23
dp = [0] * n
@@ -34,9 +34,3 @@ def job_scheduling(jobs):
34
profit_incl += dp[index]
35
dp[i] = max(profit_incl, dp[i - 1])
36
return dp[-1]
37
-
38
39
-if __name__ == "__main__":
40
- import doctest
41
42
- doctest.testmod()
0 commit comments