You have an unlimited number of 10-rupee coins and exactly one coin of r rupee and you need to buy minimum items each of cost k such that you do not ask for change.
Input: k = 15, r = 2
You should buy two cables and pay 2*15=30 rupees. It is obvious that you can pay this sum without any change.
Input: k = 237, r = 7
It is enough for you to buy one cable.
It is obvious that we can pay for 10 items without any change (by paying the required amount of 10-rupee coins and not using the coin of r rupee). But perhaps you can buy fewer hammers and pay without any change. Note that you should buy at least one item.
- Minimum cost for acquiring all coins with k extra coins allowed with every coin
- Find the minimum and maximum amount to buy all N candies
- Minimum cost to buy N kilograms of sweet for M persons
- Get maximum items when other items of total cost of an item are free
- Buy Maximum Stocks if i stocks can be bought on i-th day
- Minimum number of coins that can generate all the values in the given range
- Greedy Algorithm to find Minimum number of Coins
- Check if two items can be selected from two different categories without exceeding price
- Check if given coins can be used to pay a value of S
- Minimum change in given value so that it lies in all given Ranges
- Burst Balloon to maximize coins
- Probability of getting two consecutive heads after choosing a random coin among two different types of coins
- Path traversed using exactly M coins in K jumps
- Minimum number of distinct elements after removing M items | Set 2
- Maximum items that can be bought from the cost Array based on given conditions
- Change in Median of given array after deleting given elements
- Change the given string according to the given conditions
- Find the top K items with the highest value
- Find K items with the lowest values
- Ways to place 4 items in n^2 positions such that no row/column contains more than one
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.