Solutions for division of two positive integers

    • @TerryDic
    • @Robert, submitted in Python 2, achived 100% score
    def solve(dividend, divisor):
        if not divisor:
            return
    
        current_sum = 0
        quotient = 0
        while current_sum <= dividend:
            quotient += 1
            current_sum += divisor
    
        return quotient - 1
    • @TerryDic
    • @Robert, submitted in Python 3, achived 100% score
    def solve(dividend, divisor):
        if not divisor:
            return
    
        current_sum = 0
        quotient = 0
        while current_sum <= dividend:
            quotient += 1
            current_sum += divisor
    
        return quotient - 1