Freelancer interview question

Two Problem solving questions algorithm