Leetcode doubt greedy

I am not getting this problem.CAn u plz help me regarding this

@Somasree you need help understanding the problem requirement or with the solution?

need help understanding the problem sir

ok so you have to make a subset from the give set of elements ( the values array ) such that:

  • number of elements in your subset should be less than or equal to num_wanted.
  • number of elements with same label ( check label array with corresponding index from value array to get label of element ) should be less than or equal to use_limit in the subset you formed.

from all the possible subsets which satisfies above 2 criteria you have to print the largest possible sum of any subset S .

Can u plz help me regarding the solution too???

Yes you can implement it like this https://ideone.com/kXra5t

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.