Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kartikkukreja/71099c10941aa690d46c to your computer and use it in GitHub Desktop.
Save kartikkukreja/71099c10941aa690d46c to your computer and use it in GitHub Desktop.
Interval Scheduling Problem Implementation
sort the n requests in order of finish time
schedule = {}
last_finish = 0
for i = 1 to n:
if s(i) >= last_finish:
Add i to schedule
last_finish = f(i)
return schedule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment