Unstop Coding Question – Solved

12 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

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |