Doubt For Approach

How are we to approach this problem ? and is there any video solution available for the same . I have been trying this since yesterday yet couldn’t figure out an approach . Also as a request would you add expected time complexity in these questions as it gives us a hint as to what approach should we use?

You have to use greedy approach here

The greedy choice is to always pick the next activity whose finish time is least among the remaining activities and the start time is more than or equal to the finish time of the previously selected activity. We can sort the activities according to their finishing time so that we always consider the next activity as minimum finishing time activity.

  1. Sort the activities according to their finishing time
  2. Select the first activity from the sorted array and print it.
  3. Do the following for the remaining activities in the sorted array.
    …….a) If the start time of this activity is greater than or equal to the finish time of the previously selected activity then select this activity and print it.

i hope this help
you try to code this

if you have any doubt in this feel free to ask

Since I’m new to this concept should i watch the greedy section problems videos now or come back to this later ?

As you wish
You can come back to this later after learning from videos

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.