How to solve this problem

Problem Link
How to solve this? The below given logics are failing for some test cases.

This problem is the same as “minimum number of coins that make a change” which can be solved with DP. The number of people is the desired sum and the array of integers has the values of the coins.
Read this article:

What should be the -1 condition here, suppose V=10 and array={2,5}. Its not possible to get given value, so its -1, but the answer from this is 2

Just check if table[V] is equal to INT_MAX. If it is, answer is -1.

It is possible. 5 + 5 = 10. You can give 2 groups of five people 1 umbrella.

Oh yes, my bad. Thank you @therealnishuz :v: