Hello coding blocks i have a doubt in a question and i am not able to understand how to solve this

please provide the solution of the first question.i have tried it but i am not able to solve it