I am trying to solve below problem in hacker earth but i am unable to found solution for this.Could you please help me for this. link