Someone asked me this question:
You are given a list of intervals. You must develop an algorithm for finding a sequence of non-overlapping intervals so that the sum of the interval of intervals is maximum.
For instance:
If the specified intervals:
["06:00","08:30"], ["09:00","11:00"], ["08:00","09:00"], ["09:00","11:30"], ["10:30","14:00"], ["12:00","14:00"]
Range is maximum if three intervals
["06:00", "08:30"], ["09:00", "11:30"], ["12:00", "14:00"],
.
Therefore, the answer is 420 (minutes).
source share