Question: Simple python coding problem, please help Description: Scheduling can be hard. You've realized after looking at your calendar that you could simplify your very busy,
Simple python coding problem, please help



Description: Scheduling can be hard. You've realized after looking at your calendar that you could simplify your very busy, very long day by re-organizing it so that your meetings with a single person throughout the day are instead combined into long, singular meetings. To help, you've separated your day into several equal-sized chunks. You're not the only one with a busy schedule though, your coworkers are busy too! They've provided their availability for your scheduling convenience. You notice that some weren't even available for your original meeting time! To prevent confusion, you'd also like to preserve the order that you see people for the first time throughout the day, if possible given your coworker's availabilities. For example, if you would see John first, then Mary, and then John again, you'd like to see John first and then Mary. Please write a function to reorder your schedule according to these constraints. Your function will be given an array of names representing your current schedule broken up into equal chunks of time. You will also be provided an array of arrays, each subarray containing a name in the original calendar, that person's starting availability (inclusive), and their ending availability (exclusive). Availabilities are meant to be human-readable and start at 1. The test cases are checking for both correctness and time complexity. Examples: Input: [ [John', 'Mary', 'John', 'Peter', 'Susan', 'Peter'] Input: [['John', 2, 4], ['Mary', 1, 5], ['Peter', 5, 7], ['Susan', 3, 7]] Output: [ ['Mary', 'John', 'John', 'Susan', 'Peter', 'Peter'] Explanation: We'd like to see John first, but he isn't available so we see Mary first instead. Peter is similarly not available at his original time, so we see Susan first. Complete the 'optimizeSchedule' function below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
