← All problemsSign in

3789. Minimum Cost to Acquire Required Items

LeetCodeMathGreedyOpen on judge ↗

You are given five integers cost1, cost2, costBoth, need1, and need2. There are three types of items available: - An item of type 1 costs cost1 and contributes 1 unit to the type 1 requirement only. - An item of type 2 costs cost2 and contributes 1 unit to the type 2 requirement only. - An item of type 3 costs costBoth and contributes 1 unit to both type 1 and type 2 requirements. You must co

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start