Q1. Divide n1 by n2 without using division. Give time complexity Q2. Improve previous answer
Sigiloso
If I understood the question correctly (feedback is appreciated) #Takes into account negative inputs x = -11 #Assume n1 y = 2 #Assume n2 xneg = False yneg = False if x = 0: x = x - y n = n + 1 if xneg ^ yneg: #Exclusive or. Only one of the numbers can be negative for the result to be negative print n*-1 else: print n