IBM Interview Question

They gave coding problems only for me as I did not make it past this stage.