Multiplication Without Using * Operator
Use Recursion to multiply two numbers without using the * operator.
We'll cover the following
Problem statement
In this problem, we need to find the result of the multiplication of two numbers, a
and b
but without using *
operator. This looks like a pretty simple problem. We can easily iterate a loop from 1
to b
and add a
to our result. But there is a catch: you need to write a solution with a Recursive approach.
Implementation
Let’s write the solution first, and then visualize how recursion is working.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.