MDP Infra (India) interview question

One logic based coding question. sorry but i forgot