Unstop Coding Question – Solved

6 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

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |