TikTok Shopping Spree

Problem Overview

  • Compute the minimum total cost to buy all items using discount vouchers.
  • Input: vouchersCount (int) and prices (int array); Output: an int for the minimum total cost.
  • Each voucher halves an item's price; k vouchers on one item set price to p/2^k; vouchers can go on any item.
  • E-commerce shopping context with a TikTok influencer planning a haul.
  • From TikTok interviews; a coding interview problem and interview question on voucher allocation.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: