Soal
00:00

16. Divide Two Integers

SedangMatematikaGoogleMicrosoft

Given two integers dividend and divisor, return their quotient truncated toward zero.

Prefer an implementation that does not use multiplication, division, or the modulo operator.

Contoh 1:

Input: dividend = 10, divisor = 3
Output: 3

Contoh 2:

Input: dividend = 7, divisor = -3
Output: -2

Batasan:

  • -2^31 <= dividend, divisor <= 2^31 - 1
  • divisor != 0
Mode kode inti
● Tersimpan otomatisBaris 1, kolom 1