For those who are facing Overflow/TLE


Don’t do (mid * mid)>a logic because mid*mid definitely will lead to overflow and TLE because of wraparound so do mid>a/mid . To make sure mid doesn’t become zero intialise start=1 and end=a.
so mid=(start+end)/2


thank you so bro,for this


I think we can solve this by declaring mid as long variable which can overrides overflow error


Thank you sir i got struct at it.


Thanks man, I wouldnt have realised it was an overflow error


I would have a taken a lot of time for me to realise. After seeing comment, I realised early and follow it.


Thanks :slight_smile:


Can you explain the logic behind it . Or provide some reference behind it .


@ajay-unni_596 or use long int with (mid*mid)>a logic will get submitted


Thank you so much brother.


Bro.I know it is causing overflow but thanks for posting it bro.