Cleanup Dataset
Problem Overview
- Core task: Given a lowercase string of even length, remove characters in pairs (equal pair cost x, unequal pair cost y) to minimize the total cost to empty the string.
- Inputs/outputs: dataset string, integers x and y; return the minimum cost (int). Constraints: 2 ≤ |dataset| ≤ 1e5, even; 1 ≤ x,y ≤ 1e4.
- Domain: Cleansing a machine learning dataset efficiently.
- Company: Asked in Amazon interviews; a practical coding interview problem and interview question.
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:
