Getting wrong answer

please look at my code:

Hey @rabhi1611 you got the implementation right, but there are few mistakes which you haven’t considered , like side case in your compact function and in for loop of line number 20. Here’s the code which I have designed for you and have also added few comments in it. Try to find your mistake and implement it in your code https://ide.codingblocks.com/s/345646 :grinning: