⌘K
Flycodx

Coconut Farm Harvest Quota Planning

Coconut Farm Harvest Quota Planning

EasyArrays33% accepted

Arjun runs a coconut farm in Kerala with N trees. Each tree has different number of coconuts. He needs to plan daily harvest to meet a quota of Q coconuts. He wants to find minimum number of trees to harvest (starting from highest yield) to meet the quota.

Approach

Given array of N coconut counts per tree and target quota Q, find minimum trees needed (starting from highest) to reach quota.

Input

3 60 50 40 30

Output

2
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3