Amazon Coding Question – Solved

8 Live
Company is focused on using sophisticated algorithms to optimize inventory turnover within its warehouse network. In this case, you're given a task related to a specific operation with an array of inventory levels. Formally, you are given an array of positive integers, inventoryLevels, of size n. Additionally, you have two positive integers x and y, with x being equal to or smaller than y. You can apply an inventory operation on inventoryLevels any number of times, potentially not at all. The inventory operation involves selecting two distinct indices i and j within the array (0 < i, j< n), incrementing the value at index / in inventoryLevels by x, and decreasing the value at index j in inventoryLevels by y. Find the maximum possible value for the smallest level in inventoryLevels after the operations are performed. Note: It is possible that while performing operations, elements become negative. However, after the completion of all the operations on inventoryLevels, each value should within the array should be greater than 0. Example n=3 InventoryLevels = [11, 1, 2] X=2 y=3

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… |