Unstop Coding Question – Solved

10 Live
Problem Statement You have a budget of x coins each day to buy beer, and your goal is to buy as many bottles of beer as possible before the price of beer in all shops exceeds your daily budget. There are N shops, and each shop sells one bottle of beer per day. The price of beer in each shop increases by 1 coin per day after each purchase. You can visit multiple shops in a single day, but you can buy only one bottle per shop per day. Your task is to determine the total number of beer bottles you can buy before the prices at all shops exceed your daily budget. Input Format The first line contains two space-separated integers N, X. The number of shops and everyday budget. The second line contains N space-separated integers, representing the cost of one bottle in each shop. Output Format Print one integer representing the total number of beer bottles you can buy before prices exceed your daily budget.

Asked in: Unstop

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