Skip to content

Commit 6b73c38

Browse files
Update job_scheduling.py
1 parent 34c7ecd commit 6b73c38

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

dynamic_programming/job_scheduling.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def job_scheduling(jobs):
1717
250
1818
"""
1919
# Sort jobs by end time
20-
jobs.sort(key=lambda x: x[1])
20+
jobs = sorted(jobs, key=lambda x: x[1])
2121
n = len(jobs)
2222
# dp[i] stores max profit including jobs[i]
2323
dp = [0] * n
@@ -34,9 +34,3 @@ def job_scheduling(jobs):
3434
profit_incl += dp[index]
3535
dp[i] = max(profit_incl, dp[i - 1])
3636
return dp[-1]
37-
38-
39-
if __name__ == "__main__":
40-
import doctest
41-
42-
doctest.testmod()

0 commit comments

Comments
 (0)