New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
JobRadar
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
TikTok
Coding Question
AI Insights
Quick Summary
You are given an array of product prices and a fixed number of discount vouchers.
Each voucher halves the current price of any single item, and multiple vouchers can target the same product.
The goal is to distribute vouchers optimally to minimize the sum of all final prices.
What This Tests
Greedy strategy formulation and optimality reasoning
Priority queue (max-heap) implementation and management
Complexity analysis under large input constraints
Recognition of diminishing returns in geometric reductions
Common Patterns
Greedy
Heap / Priority Queue
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected