What will be the output for the input if given below?

1

3

10 12

15 17

19 30

Hi @Doctor_Insult, the answer for the following input will be 3 as we can do all 3 task in the given order
as none of the intervals are overlapping

In case of any doubt feel free to ask :slight_smile:
If you got the answer then mark your doubt as resolved

Isn’t this problem DP based? I mean I cannot think of any algo which can solve this problem, and as of now, I have not done DP. Should I leave it?

this is a greedy based solution

thanks a lot. I was doing it in reverse.