Company: IBM India-standard-general software
Difficulty: medium
A financial advisor is managing n different assets, where the number of shares for the i th asset is given by assetAmounts[i] . The advisor needs to split these assets into two portfolios, A and B, such that: Portfolio A contains the first j assets. Portfolio B contains the remaining assets. The split point j must satisfy 1 ≤ j < n (both portfolios must be non-empty). The advisor wants an equal number of shares in both portfolios. Any number of transactions can be performed to equalize the portfolios. Each transaction can increase or decrease the shares of any asset by 1. The shares of each asset must remain positive, i.e., greater than 0. Implement a function that determines the minimum number of transactions required to achieve this balance, considering the optimal split point j . The function getMinimumTransactions will take one input: int assetAmounts[n] : each assetAmounts[i] is the number of shares for the i th asset The function should return the minimum number of transact