Divide Two Integers
Medium · Bit Manipulation · about 25 minutes
Asked at Meta, Google, Amazon, Microsoft, Bloomberg, Goldman Sachs.
Divide dividend by divisor without using multiplication, division or mod, truncating toward zero. Both are 32-bit signed integers and divisor != 0. If the quotient overflows (only -2³¹ / -1), return 2³¹ − 1.