this code is working fine and passes all the test cases, but sir I have a question can I do anything else or any other approach to solve the question?
Code optimization
hi @ritikbunty2511_729d0258992e0982, this also looks good,
ok so here first of all numbers we are given represent q different queries… in first query Alex has 100 rs with him and shopkeeper claims k ie 2 products.
in ques it is mentioned that alex want to spend whole amount of money… for this we traverse and check for how many diff products it is possible to spend whole amount and buy and maintain a count… if this cnt is >= k then ans is Yes else No
code
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.