Your question is Therapy Practice Coding Extension. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Headway needs to select a profitable daily schedule of therapy sessions for one clinician. Implement optimize_schedule(sessions) to choose a set of non-overlapping sessions with maximum total value.
A session is compatible with another when the earlier session's end time is less than or equal to the later session's start time. The clinician cannot attend overlapping sessions. If multiple schedules have the same maximum value, prefer the schedule produced by skipping the latest session considered during dynamic programming. Returning no sessions is valid.
Input is a list of dictionaries. Each dictionary contains a unique string id, an integer start, an integer end, and a non-negative integer value. Return a list of selected session IDs in chronological order. The selected IDs must represent pairwise compatible sessions and maximize the sum of their values.
def optimize_schedule(sessions):