Amazon Books is a retail store that sells the newly launched novel "The Story of Amazon". The novel is divided into n volumes numbered from 1 to n and unfortunately, all the volumes are currently out of stock.
The Amazon team announced that starting today, they will bring exactly one volume of "The Story of Amazon" in stock for each of the next n days. On the nth day, all volumes will be in sto
Asked in: AMAZON
In an Amazon analytics team, the Analysts collectively have a preference for the number zero and a disapproval towards negative numbers. Their objective is to determine the maximum number of zeroes achievable after performing a series of operations (possibly zero) on an array, all while avoiding negative values.
Formally, given an array sequenceData of size n of positive integers, the Analysts
Asked in: AMAZON
AWS provides scalable systems. A set of n servers are used for horizontally scaling an application. The goal is to have the computational power of the servers in non-decreasing order. To do so, you can increase the computational power of each server in any contiguous segment by x. Choose the values of x such that after the computational powers are in non-decreasing order, the sum of the x values i
Asked in: AMAZON
A foundry in Hackerland makes an alloy out of n different metals. In the manufacturing of an alloy, the composition of each metal is fixed, where the required quantity of the i-th metal in preparing 1 unit of the alloy is denoted by composition[i]. The company already has stock[i] units of metal i in their stock. The company has a budget to purchase any of the metals if needed. The cost of the i-t
Asked in: MICROSOFT
An array of integers is almost sorted if at most one element can be deleted from it to make it perfectly sorted, ascending. For example, arrays [2, 1, 7], [13], [9, 2], and [1, 5, 6] are almost sorted because they have 0 or 1 elements out of place. The arrays [4, 2, 1] and [1, 2, 6, 4, 3] are not because they have more than one element out of place. Given an array of n unique integers, determine t
Asked in: MICROSOFT
The binary cardinality of a number is the count of 1's in its binary representation. For example, the decimal number 10 corresponds to the binary number 1010, which has a binary cardinality of 2 because it contains two 1's. Given an array of decimal integers, sort it by: 1. Increasing binary cardinality (primary criterion) 2. Increasing decimal value (secondary criterion, when cardinalities are eq
Asked in: MICROSOFT
Amazon has multiple delivery centers for the distribution of its goods. In one such center, parcels are arranged in a sequence where the ith parcel has a weight of weight[i]. A shipment is constituted of a contiguous segment of parcels in this arrangement.
For example, with weights [3, 6, 3], possible shipments include [3], [6], [3], [3, 6], [6, 3], and [3, 6, 3], but not [3, 3] (since itβs not
Asked in: AMAZON
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