You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
7
+
8
+
Return the quotient after dividing dividend by divisor.
9
+
10
+
The integer division should truncate toward zero.
11
+
12
+
Example 1:
13
+
14
+
Input: dividend = 10, divisor = 3
15
+
Output: 3
16
+
Example 2:
17
+
18
+
Input: dividend = 7, divisor = -3
19
+
Output: -2
20
+
Note:
21
+
22
+
Both dividend and divisor will be 32-bit signed integers.
23
+
The divisor will never be 0.
24
+
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, assume that your function returns 231 − 1 when the division result overflows.
0 commit comments