Update the linear time solution.