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.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- 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
- How to sum two integers without using arithmetic operators in C/C++?
- Smallest number to multiply to convert floating point to natural
- Basic Operators in Java
- C++ program to divide a number by 3 without using *, / , +, -, % operators
- Number of substrings divisible by 6 in a string of integers