Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions