I haven't got any good ideas how to solve this=(

Update1:

Today I found very interesting blog where there is the solution of this problem with code: http://www.darrensunny.me/leetcode-divide-two-integers/

Update2:

This is my implementation:

```
class Solution {
public:
int divide(int dividend, int divisor) {
if (dividend == divisor) return 1;
if (divisor == INT_MIN) return 0;
int quotient = 0;
if (dividend == INT_MIN) {
dividend += abs(divisor);
quotient = 1;
}
int sign = ((dividend < 0) ? -1 : 1) * ((divisor < 0) ? -1 : 1);
dividend = abs(dividend);
divisor = abs(divisor);
int d = divisor;
int shift = 0;
while (divisor <= (dividend >> (shift + 1))) shift++, divisor <<= 1;
while (dividend >= d) {
while (dividend < divisor) divisor >>= 1, shift--;
quotient += 1 << shift;
dividend -= divisor;
}
return quotient * sign;
}
};
```