Rayark interview question

Algorithm questions with straightforward solution. No further extension to the problem after giving the solution.