Tap here to switch tabs
Problem
Submissions

Problem: Minimum Cost of Buying Candies With Discount

med
30 min
Try to solve the Minimum Cost of Buying Candies With Discount problem.

Statement

A shop is offering a special discount on candies. For every 22 candies purchased at their regular prices, you can choose a 33rd candy to take for free. The cost of the free candy must be less than or equal to the minimum cost of the 22 purchased candies.

You are given an integer array cost, where cost[i] denotes the price of the candy at index i. Return the minimum total cost required to acquire all candies.

Constraints:

  • 1≤1 \leq cost.length ≤100\leq 100

  • 1≤1 \leq cost[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Cost of Buying Candies With Discount

med
30 min
Try to solve the Minimum Cost of Buying Candies With Discount problem.

Statement

A shop is offering a special discount on candies. For every 22 candies purchased at their regular prices, you can choose a 33rd candy to take for free. The cost of the free candy must be less than or equal to the minimum cost of the 22 purchased candies.

You are given an integer array cost, where cost[i] denotes the price of the candy at index i. Return the minimum total cost required to acquire all candies.

Constraints:

  • 1≤1 \leq cost.length ≤100\leq 100

  • 1≤1 \leq cost[i] ≤100\leq 100