Letter Candles
Easyintuit
Problem Overview
- Minimize the box cost: sum of squares of each letter’s count in S after removing up to M candles.
- Input: N, M, and lowercase string S (length N). Output: smallest possible cost (integer).
- Context: Alice’s letter candle box where cost depends on letter distribution; she may discard up to M.
- From Intuit interviews; a coding interview problem and interview question on cost from character counts.
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:
