Process time intervals and detect overlaps/gaps | Sierra Coding Question