I have used a very simple algorithm that first, I attended all the sessions which were 1 hour long, and then recursively check all the longer slots. If there are no shoter slots booked in the longer slot, then attend it otherwise, do not attend it. I have made the name of the file on which you have to test the code as a command line arguement, so please provide it as like, if file name is "schedule.txt", then run the code as ./a.out schedule.txt There is a class Schedule that stores some attributes related to the sessions and the slots that are there in the schedule. The functions are commented in the code with their functionalities.
It is quiet unfortunate for me as I was not able to complete this task, as I am travelling to campus on 19th and the packing of travel and all related things didn't let me complete task 2.