A user is using the Amazon fitness tracker and is engaged in a jumping exercise routine. The user is positioned on the ground, and there are n blocks, each placed at different heights. The height of the ith block is represented by height[i] feet.
The goal is to maximize the calorie burn during this exercise. The calories burned when jumping from the ith block to the jth block is calculated as (
Asked in: AMAZON
Amazon Kindle has several e-books that customers can purchase directly. There are n books ordered sequentially numbered 1, 2, ..., n, where the ith book has a cost of cost[i]. A customer wants to purchase all the books, and Kindle offers the customer a unique discount to minimize their total cost. The discount is described as follows:
1. Let the leftmost book remaining in the sequence be book i
Asked in: AMAZON
The engineering team at an Amazon fulfillment center is optimizing n high-performance printers, where each printer can print pages[i] number of pages. Each printer can be in exactly one of three states: operational, idle, or suspended.
Printers initially start in an idle state and can be activated one by one. However, if too many printers are active at once, some will get suspended due to their
Asked in: AMAZON
The supply chain manager at one of Amazon's warehouses is shipping the last container of the day. All n boxes have been loaded into the truck with their sizes represented in the array `boxes`. The truck may not have enough space to store all the boxes, so some boxes may need to be unloaded. The remaining boxes must satisfy the condition:
`max(boxes) ≤ space * min(boxes)`.
Given the array `bo
Asked in: AMAZON
Determine the highest value after executing n steps on an infinite 2D grid that initially contains all zeros. The grid is indexed from (1,1) at the bottom-left corner with coordinates increasing upwards and to the right.
For each given coordinate pair (r, c), increment every cell in the rectangle from (1,1) to (r,c) inclusive by 1. After processing all coordinates, return the number of cells th
Asked in: JPMORGAN
In this new stock prediction game launched on Amazon Games, Player 1 provides Player 2 with stock market data for n consecutive days, representing Amazon's stock prices on each day, represented by the array stockData.
The rules of the game are as follows:
1. Player 1 will tell Player 2 a specific day number i (where 1 ≤ i ≤ n).
2. Player 2 has to find the nearest day j (1 ≤ j ≤ n, j ≠ i) in t
Asked in: AMAZON
Amazon operates numerous warehouses, with each warehouse holding inventory[i] units of a particular product. You and your co-worker are responsible for dispatching these items to fulfill customer orders, following a specific process:
1. When dispatching from warehouse i, you begin by reducing the inventory of the i-th warehouse by dispatch1 units.
2. After your dispatch, your co-worker reduc
Asked in: AMAZON
In Amazon's highly efficient logistics network, minimizing operational overhead and optimizing package routing is crucial to ensure smooth deliveries across various regions. The network consists of n warehouses, numbered from 1 to n, each strategically positioned at its corresponding index. Each warehouse has a specific storage capacity, given by warehouseCapacity, where warehouseCapacity[i] repre
Asked in: AMAZON
Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to m, there are x blocked cells. Their positions are specified by the array blockedPositions[i][] where blockedPositions[i][1] represents the row and blockedPositions[i][2] represents the column position, using 1-based indexing.
Starting from the top-left cell (1, 1), the goal is to reach the bottom-right cell (n, m) wi
Asked in: CISCO
There are 'N' coders standing in a line, where i denotes the ith position of a coder with a rating of Ri. All ratings are distinct.
You have to form a team of 3 from amongst them with the condition:
- Any three coders with positions (i, j, k) and ratings (Ri, Rj, Rk) can form a team when ("Ri < Rj < Rk" or "Ri > Rj > Rk") and (1 <= i < j < k <= N).
You have to find out how many such teams e
Asked in: GOLDMANSACHS