Company: NAB_28nov
Difficulty: medium
Maximum Investment Income Maximum Investment Income Problem Description You're handed a record of an asset's daily prices over the past N days. Work through the record to figure out the largest income you could have made from trading it. Suppose you start out already holding one unit of the asset, and you can never hold more than one at a time. At any point where you're holding the asset, you're free to sell it. At any point where you aren't holding it, you're free to buy one (funds are never a limiting factor). What's the largest income achievable under these rules? Write a function: class Solution { public int solution(int[] A); } that, given an array A of length N holding the daily prices, returns the largest achievable income. Because the true value may be huge, return only its last nine digits, without leading zeros (i.e., the value modulo 1,000,000,000). Examples Example 1: Given A = [4, 1, 2, 3], the function should return 6. Explanation: Sell on day one (at 4), buy back on day