Add algo for merging intervals