Tap here to switch tabs
Problem
Submissions

Problem: Divide Two Integers

med
30 min
Try to solve the Divide Two Integers problem.

Statement

Given two integers dividend and divisor, return the quotient after dividing dividend by divisor.

The division result should be truncated toward zero.

You must not use multiplication, division, or modulo operators.

Note: Assume the result fits in a 3232-bit signed integer.

Constraints:

  • −231≤-2^{31} \leq dividend, divisor ≤231−1\leq 2^{31} - 1

  • divisor != 0

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Divide Two Integers

med
30 min
Try to solve the Divide Two Integers problem.

Statement

Given two integers dividend and divisor, return the quotient after dividing dividend by divisor.

The division result should be truncated toward zero.

You must not use multiplication, division, or modulo operators.

Note: Assume the result fits in a 3232-bit signed integer.

Constraints:

  • −231≤-2^{31} \leq dividend, divisor ≤231−1\leq 2^{31} - 1

  • divisor != 0