Help ramu - hint to approach problem

Can anyone give a hint as to what to do in this question? Or how to approach?

This is the link to the video. Take idea and try to understand from it and code the solution yourself.