⌘K
Flycodx

Blood Bank Donation Fulfillment Optimization

Blood Bank Donation Fulfillment Optimization

HardArrays100% accepted

Bangalore's Red Cross blood bank tracks inventory by expiry date and blood type compatibility. Maximize the number of compatible donation requests fulfilled without exceeding shelf life constraints. Rule: a donation can fulfil a request only if blood groups match exactly and its expiryDays > 0. Each donation fulfils at most one request. Return the maximum number of requests fulfilled. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.

Approach

Given donation expiry dates, blood types, and compatible requests, maximize fulfilled donations.

Input

expiryDays=[5,8,3,10] types=["O+","O+","A+","B+"] requests=["O+","A+","AB+"]

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