Challenges : Greedy, Deepak and his journey

Why is it not working correctly?

hello @deep4013

check ur updated code here->

becuase of overflow it was giving wa, use long long

But the constraints were <=10^5. Then why the overflow?

we are multiplying two terms that are order of 10^5.
and becuase of that the resultant can be of order 10^10(greater than the integer range) right?
integer cant handle that so use long long

Ok, thanks for help. Close this doubt too.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.