**Input:**Set of intervals(time)

**Output:**Partition of intervals into minimum subsets such that no interval in a subset overlaps.

You can think of it as some users asking to get their tasks done on computers between fixed time intervals they give and you have to schedule them on minimum number of computers - tasks are non-preemptive and only one task at a time can execute on a computer.

**The Algorithm:**Sort intervals by start times and look them in this order, put each interval in the first subset in which it can(without overlap).

**My Question:**Is the following approach wrong?

**My Approach:**Sort intervals by ending times, put each interval in the first subset in which it can(without overlap).

For Example:

Let the intervals be: {(0, 5), (5, 10), (4, 9), (10, 11)}

Then output should be:

[(0, 5), (5, 10), (10, 11)].

[(4, 9)].

Which uses minimum i.e 2 subsets or 2 computers.

Please help. This approach is not given anywhere so is it wrong? I guess a counter example will do, but I can't really find any. All cases that I've considered give correct results.