:type dividend: int :type divisor: int :rtype: int
(self, dividend, divisor)
| 35 | """ |
| 36 | class Solution(object): |
| 37 | def divide(self, dividend, divisor): |
| 38 | """ |
| 39 | :type dividend: int |
| 40 | :type divisor: int |
| 41 | :rtype: int |
| 42 | """ |
| 43 | |
| 44 | x = abs(dividend) // abs(divisor) |
| 45 | if (dividend < 0 and divisor > 0) or (dividend > 0 and divisor < 0): |
| 46 | |
| 47 | if -x < -2**31: |
| 48 | return -2**31 |
| 49 | return -x |
| 50 | |
| 51 | if x > 2**31-1: |
| 52 | return 2**31-1 |
| 53 | return x |
| 54 |
nothing calls this directly
no outgoing calls
no test coverage detected