Currently, he has N cheese with distinct calorie value a1,a2,…,ana1,a2,…,an. Jerry wants his total calorie intake to be K. To achieve his calorie diet, he can steal at most 1 cheese such that:
- its calorie value should lie between the minimum and maximum calorie value of cheese he already has
- its calorie value should not coincide with any available cheese calorie value
Then as per your inputs if we input 3 as N means we have 3 cheese available and K=6 means calories required =6
since value of calories previously available are 1,2 and 3 then then as per 1st point he can’t have further calories,
this is what I understood of the question
can you please let me know of the right answer to help me develop?