Can someone tell me the idea to approach this problem. I couldn’t figure out the proper logic.
Link: Programming Problems and Competitions :: HackerRank