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
Amazon Prime Video is developing a new feature called "Segmentify." This feature applies to a video with n (even) visual frames, where each frame is represented by a binary character in the array `frames`. In this format, a "0" represents a black pixel, and a "1" represents a white pixel.
Due to factors like lighting and camera angles, some frames may need horizontal or vertical flips (changing
Asked in: AMAZON
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
A birthday party was attended by N number of kids, and each kid was given a unique ID ranging from 1 to N. As a return gift, there are T toys that must be distributed to the kids.
The host decided the best way to do this is by sitting the kids down in a circle (ordered by ascending ID), and then, starting with a random number D (between 1 and N), distribute one toy at a time to each sequentiall
Asked in: GOLDMANSACHS
Given a matrix of size m * n, where m denotes the number of rows (starting with index 0) and n denotes the number of columns (starting with index 0), the matrix will hold distinct integers as elements.
We need to find the distinct number of positional elements that are either the minimum or maximum in their corresponding row or column. If any row or any column has multiple minimum or maximum el
Asked in: GOLDMANSACHS