🎁 Exclusive Offer! Join our Telegram Channel to get **special discounts** and updates! 🚀

🚀 Struggling with coding interviews? We've got you covered! 💡 Practice real questions, sharpen your skills, and land your dream job! 🎯
Question 17 - 100% Working Solution | Buy Now

Description

7 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