Link to code : https://ide.codingblocks.com/s/229122
my solution works fine for the given test case, but gives WA after submission
have a look and tell me what’s wrong
WA on submission
link to the solution is not the best way to clear someone’s doubt (:
@O17LPOLA020011
your code gives u tle so i gave u an optimised aproach.if u have any other doubt please let me know