Product Sum

Approach

Tools

- Recursion

- Type check in Java


Technique

- take a variable name sum

- loop through the object

- check type

- if type ArrayList, then recursively call the function with (multiplier + 1)

- otherwise add element in the sum

- after for loop, multiply sum with multiplier

Code Solution

Share