Question: Code a method in java that takes an array of integers as input and returns an array of integers as output. The value of cell
Code a method in java that takes an array of integers as input and returns an array of integers as output. The value of cell i in the returned array is the sum of cell i and all the previous even numbers if cell i is even and is the sum of cell i and all the previous odd cells if cell i is odd.
Example
input: [1,2,3,4,5,6,7,8,9]
output: [1,2,4,6,9,12,16,20,25]
Note: no side effect should occur on the input array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
