प्रश्न
00:00

16. Divide Two Integers

मध्यमगणितGoogleMicrosoft

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.

उदाहरण 1:

इनपुट: dividend = 10, divisor = 3
आउटपुट: 3

उदाहरण 2:

इनपुट: dividend = 7, divisor = -3
आउटपुट: -2

सीमाएँ:

  • -2^31 <= dividend, divisor <= 2^31 - 1
  • divisor != 0
मुख्य कोड मोड
● अपने आप सहेजा गयापंक्ति 1, कॉलम 1