Company: NAB_28nov
Difficulty: medium
Maximum Investment Income Maximum Investment Income Problem Description You are given a record of the historical prices of an investment asset from the last N days. Analyze the record in order to calculate what could have been your maximum income. Assume you started with one asset of this type and could hold at most one at a time. You could choose to sell the asset whenever you held one. If you did not hold an asset at some moment, you could always afford to buy an asset (assume you had infinite money available). What is the maximum income you could make? Write a function: class Solution { public int solution(int[] A); } that, given an array A of length N representing a record of prices over the last N days, returns the maximum income you could make. As the result may be large, return its last nine digits without leading zeros (return the result modulo 1,000,000,000). Examples Example 1: Given A = [4, 1, 2, 3], the function should return 6. Explanation: You could sell the product on th