
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains two space-separated integers ‘n’ and ‘amount’, where ‘n’ denotes the number of elements in the array ‘prices’.
The second line of each test case contains n space-separated integers denoting the elements of the array ‘prices’.
For every test case, return the maximum number of stock that you can buy.
Output for each test case will be printed in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= T <= 100
1 <= N <= 3000
1 <= Amount <= 10^9
1 <= prices[i] <= 10^9
Where ‘T’ represents the number of test cases, ‘N’ is the number of elements in array ‘prices’, ‘amount’ denotes an integer. ‘prices[i]’ represents the value of the number at ‘i’ position in ‘prices’.
Time Limit: 1 sec
The key idea observation here is that we should always buy stock with minimum price. Suppose the minimum stock price is ‘x’ and you can buy only ‘i’ number of stock in ‘k’ amount.
If k>= i*x then you can buy ‘i’ stock, remain amount ‘k- i*x’.
Else you can buy ‘k/x’ stocks and remain amount is ‘k- i*(k/x)’.