Solve almost-sorted-interval challenge