解題說明
C++ 解法
複雜度分析
虛擬碼
1. Handle special case: dividend == INT_MIN and divisor == -1, return INT_MAX 2. Determine sign based on XOR of signs of dividend and divisor 3. Convert both to positive long values 4. result = 0 5. While a >= b: a. temp = b, multiple = 1 b. While a >= temp * 2: temp *= 2, multiple *= 2 (use bit shifts) c. a -= temp, result += multiple 6. Return sign * result (clamped to int range)