Solving Divide Two Integers in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

The integer division should truncate toward zero.

Example 1:

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

Example 2:

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


  • The divisor will never be 0.

See the full details of the problem Divide Two Integers at LeetCode

Originally posted at: