Our side project is doing well and we need to hire a few security guards to keep our sweet new office space secure. It won't take more than one to secure the office. Instead of juggling schedule requests for this position you write a program to handle it for you. Below are the names of the security guards and their requested schedules for tomorrow. Write a program so that one security guard is always on duty. Feel free to adjust the input format as needed since this is your program after all.
Jack: ['0000-200', 500-1200] Jackie: ['0000-600', '800-1300'] Marty: ['400-600', '1100-1600', '1700-2359'] Ronald: ['600-1200', '1300-1800', '1900-2359'] Ke$ha: ['1600-2359'] Tim: ['500-1200', '1530-1900', '2000-2300'] Snoo: ['700-900']
Some peoples shift may need to be cut short or start early but the times listed are the only hours they can work between (minimum 59min work shift).
For some fun bonus challenges optimize so that the most amount of people can work or the fewest amount of people can work.
Comments:
Jt - 10 years, 8 months ago
C#, there's surely a lot of edge cases that I'm missing, but it works for the example given, I didn't have time to work out the bonus most amount of people option.
reply permalink
Max Burstein - 10 years, 8 months ago
Well done!
reply permalink
gulliverbear - 10 years, 8 months ago
reply permalink