Leetcode has added the new case for this problem, when overflow occurs, need to return INT_MAX, the current code can NOT be accepted. I adjust the return code as this and accepted.
long long ret = ((dividend^divisor) >> 31)?(-multi): multi;
if (ret > INT_MAX)
return INT_MAX;
else
return ret;
Leetcode has added the new case for this problem, when overflow occurs, need to return INT_MAX, the current code can NOT be accepted. I adjust the return code as this and accepted.