solve(dividend, divisor) — divide two integers **without using multiplication,
division or modulo operators. The quotient truncates toward zero** (7 / -3 is -2,-7 / 2 is -3). divisor is never 0. Clamp the result to the 32-bit signed range:-2147483648 / -1 overflows, so return 2147483647.
Subtracting the divisor one at a time is O(quotient). Use doubling instead: repeatedly
double a copy of the divisor (and a matching multiple) while it still fits in what is left of
the dividend, subtract the biggest copy, add its multiple to the quotient, and repeat. That
is long division in binary: O(log² n).
Work with absolute values and apply the sign at the end.
Examples
solve(10, 3) → 3
solve(7, -3) → -2
solve(-7, 2) → -3
solve(-2147483648, -1) → 2147483647Sample tests