Want Solution of this problem

As far as I remember, this is from some hiring challenge of hackerearth. Please post the link of this problem.

Actually first time I am asking question here, so I can understand what is meant by flagged. Can u help.

They don’t store questions of any contest, I won’t be able to provide link of that.