1 4 6
1 2 10
2 4 9
...
The first event transcends the start of the third event, right? But I'm selecting the second because it does not clash with any other and gives me maximum cost.
OTOH, if the input would've been:
1 5 2
1 2 5
2 4 9
...
The first even transcends the other two but I ignore it and select 2 4 9 because the event takes less time and is more profitable.
I hope its clearer now. If not, let the problem statement rest and comment on the algorithm that I coded. I'll search for the exact problem statement and repost this question.
My apologies, but this question bugs me periodically and for a while I get really intense about solving it and get carried away. :). |