This Python Notebook (https://github.com/rishiraj824/scheduling/blob/master/scheduling.ipynb) demonstrates the scheduling algorithm for a list of activities provided through a CSV. It uses the dynamic programming approach to solve for the most compatible activities.
The above solution works for any given activity board as it takes into account the maximum earnings from those activities.
We first sort all our activities based on their finish times and compare the activities one by one to find the next compatible activity because activities cannot overlap each other.
We use a binary search to find the most compatible activity. This takes us O(lg n) time.
We do this n times and while we do this we save the activity names to output all the possible activities in the end.
Keep adding the reward of all the compatible, highest rewards and display the sum in the end.