Marks :100
: 0 | : 0
Today is raining in the city Given an array of umbrellas of size N. umbrella[i] means the number of people that it can cover. Find the minimum number of umbrellas needed to cover exactly the amount of people X. If not possible, return -1.
The first line of input contains two integers N and X the number of umbrellas and people needs to cover ($$$1 \le N \le X\le 100000$$$).
The next line contains N space integers of the array.
Print the minimum number of umbrellas needed to cover all X persons or print -1
5 12 1 2 4 11 8
2
3 11 1 4 4
-1
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.