LeetCodeMinimum Cost of Buying Candies With DiscountMinimum Cost of Buying Candies With DiscountEasyArrayGreedySortingSolution export function minimumCost(cost: number[]): number { const n = cost.length; cost.sort((a, b) => b - a); let answer = 0; for (let i = 0; i < n; i++) { if (i === 0 || (i + 1) % 3 !== 0) { answer += cost[i]; } } return answer; }LeetCodeMinimum Cost of Buying Candies With Discounthttps://leetcode.com/problems/minimum-cost-of-buying-candies-with-discount