To be efficient, Amazon must optimally distribute parcels among their delivery agents. Initially, there are n agents, and the number of parcels assigned to the i-th agent is initialParcels[i]. There are additionalParcels parcels that also need to be shipped. The additional parcels should be assigned such that the maximum number of parcels assigned to any one agent is minimized.
Given an integer
Asked in: AMAZON
The Amazon warehouse receives a multitude of packages every day, each assigned a unique identifier from 1 to n. The warehouse manager must sort the packages, not by their identifiers, but rather through a specific process defined by a permutation packageSequence that ensures optimal processing.
Initially, the number of sorted packages, sortedCount, is zero. In each operation, the manager sifts
Asked in: AMAZON
As an operations engineer at Amazon, you are responsible for organizing the distribution of n different items in the warehouse. The size of each product is provided in an array productSize, where productSize[i] represents the size of the i-th product.
You construct a new array called variation, where each element variation[i] is the difference between the largest and smallest product sizes amon
Asked in: AMAZON
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