How to approach this problem

shall I made structure in this question or only sort start time

The idea is to sort on basis of end time.

so shall we made pair

Yes, do you want me to share the complete approach?

approach explanation with code

You can check this article https://www.geeksforgeeks.org/activity-selection-problem-greedy-algo-1/

This is the approach used

  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.
    In the following C implementation, it is assumed that the activities are already sorted according to their finish time.

Done @Devwrat Sahu Bhai Thank you

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.