Product of Digits - II
Given a non-negative integer N, return the product of all digits present in N using recursion.
Note:
A normal iterative solution will pass the test cases, but the goal of this problem is to solve it using recursion and strengthen your understanding of recursive calls and base cases.
Example 1:
Input: N = 1234
Output: 24
Explanation: The product of the digits is 1 * 2 * 3 * 4 = 24.
Example 2:
Input: N = 105
Output: 0
Explanation: The product of the digits is 1 * 0 * 5 = 0.
Now Your Turn!
Pick the correct output for the given inputInput: N = 234
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 0 <= N <= 109