🎁 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 35 - 100% Working Solution | Buy Now

Description

4 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