Amazon Coding Question – Solved

8 Live
Prime Jumps There is a game that is played as follows: There is a pawn located at cell 0, and its score is 0. There is a row of n cells numbered from 0 to n-1 from left to right. Each cell has a value, and the first cell always has a value of 0. In a single move, the pawn can move either: one cell to the right, or some number p cells to the right where p is a prime number ending in 3, e.g., 3 and 13. The pawn cannot move beyond the last cell. When the pawn enters a cell, its value is added to the score. The game ends after the pawn lands on the last cell at n-1. Determine the maximum possible score. Example cell = [0, -10, -20, -30, 50] There are n = 5 cells in the array, with cells numbered from 0 to 4.

Asked in: Amazon

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |