Company: Agoda_16nov
Difficulty: medium
Coin Collection Problem Description In a new online game, players navigate a 2 x n matrix (2 rows, n columns) where each cell initially contains a certain number of coins. The number of coins in a cell increases over time - at time k, the cell at position (i, j) contains k * coins[i][j] coins. A player must: - Start from position (0, 0) at time t = 0 - Move to a neighboring cell in one unit of time - Visit each cell exactly once - Collect all coins in visited cells Determine the maximum number of coins a player can collect. Complete the function getMaxCoins in the editor. This function is expected to return a long integer, representing the maximum number of coins that can be collected. It accepts the following parameter: int coins[2][N], which is the initial number of coins in the matrix. Examples Example 1: (Illustrative Path) Input: n = 4 coins = [[1, 4, 3, 2], [2, 1, 3, 2]] The optimal path and coin collection is shown below: Time | Cell | Coins -----|---------|---------- 0 | (0, 0)