First two comments added for the first problem explaining the problem and what has to be done in the problem to get the answer.