By making use of recursion, we can multiply two integers with the given constraints.
To multiply x and y, recursively add x y times.
Time Complexity: O(y) where y is the second argument to function multiply().
Please write comments if you find any of the above code/algorithm incorrect, or find better ways to solve the same problem.
- Efficient way to multiply with 7
- Write you own Power without using multiplication(*) and division(/) operators
- Check if a number is multiple of 5 without using / and % operators
- Median in a stream of integers (running integers)
- Add two numbers without using arithmetic operators
- DFA based division
- Russian Peasant (Multiply two numbers using bitwise operators)
- Find the smallest number whose digits multiply to a given number n
- Multiply two polynomials
- Find a pair with maximum product in array of Integers
- Sum of Bitwise And of all pairs in a given array
- How to avoid overflow in modular multiplication?
- Modular Division
- Count 'd' digit positive integers with 0 as a digit
- Count positive integers with 0 as a digit and maximum 'd' digits
Improved By : Mithun Kumar