Tap here to switch tabs
Problem
Submissions

Problem: Divide Two Integers

Divide Two Integers asks you to return the quotient of two integers, truncated toward zero, without using multiplication, division, or modulo operators.

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

Divide Two Integers asks you to return the quotient of two integers, truncated toward zero, without using multiplication, division, or modulo operators.

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