Company: Publicis Sapient_27sept
Difficulty: medium
Maximum Coins in a Grid Path 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 t, the cell at position (i, j) contains t * 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. Examples Example 1: Input: n = 4 coins = [[1, 4, 3, 2], [2, 1, 3, 2]] Optimal path (as shown in image) and coins collected based on input coins array: Time (t) | Cell | coins[i][j] | Collected (t * coins[i][j]) ---------|--------|-------------|---------------------------- 0 | (0,0) | 1 | 0 * 1 = 0 1 | (1,0) | 2 | 1 * 2 = 2 2 | (1,1) | 1 | 2 * 1 = 2 3 | (0,1) | 4 | 3 * 4 = 12 4 | (0,2) | 3 | 4 * 3 = 12 5 | (1,2) | 3 | 5 * 3 = 15 6 | (0,3) | 2 | 6 * 2 = 12 7 | (1