We all are familiar with the classic scheduling algorithm where there are **n** jobs with start time **S**i and end time **F**i for **i**’th job and we need to find the maximum subset of the jobs such that no two job in the subset overlap with each other. We also know that this can be solved easily using greedy algorithm.

The approach of solving the algorithm is to sort the jobs based on their finish time in non decreasing order and then take jobs starting from the 1st one such that the newly selected job is compatible with the already selected ones.

But in case the time axis is circular, that means if a job can have **F**i<**S**i, what will be the algorithm to solve the job in that case.

Here by circular time axis I mean if the total time length is 0-24 then 24 is equivalent to 0 and a job can start at 23 and end at 5.