Not able the logic of help ramu problem

plz explain the logigs of help ramu problem
https://online.codingblocks.com/player/3062/content/60