{

class Solution:

# @return an integer

def divide(self, dividend, divisor):

```
if dividend == 0:
return 0
sign = 1 if(dividend <0 and divisor <0) or (dividend >0 and divisor >0) else -1
dividend = abs(dividend)
divisor = abs(divisor)
ans = 0
while dividend >= divisor:
shift = 0
while ((divisor << shift) <= dividend):
shift +=1
ans += 1<<(shift-1)
dividend -= divisor<<(shift-1)
return ans if (sign==1) else -ans
```

}

{

Submission Result:

Wrong Answer Input: -2147483648, -1

Output: 2147483648

Expected: 2147483647

}

I think my output is correct instead of the expected answer, but my code cannot be accepted. I think it should be some overflow problem. Could someone tell me how can I make this problem? Thanks!