This is a verified interview question from Salesforce. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Salesforce Records Archival" covers key patterns like Strings.
"A Salesforce Admin is tasked with optimizing a data cleanup process in a Lightning Component. The component displays a sequence of customer records represented as lowercase English letters. To improve efficiency, adjacent records with the same value can be grouped and archived in a single operation. After an operation, the remaining records concatenate. The goal is to determine the minimum number of operations required to archive all records and streamline the component for better performance. ### Problem Suppose n = 5 and records = "aabbaa". a a b b a a delete "bb" a a a a delete the remaining string as it consists of the same character String is empty The minimum number of operations required to archive all records is 2.  ### Function Description Complete the function getMinArchiveOperations in the editor below. getMinArchiveOperations has the following parameter: string records: the sequence of customer records in the Lightning Component ### Returns int: the minimum number of operations required to archive all records ### Constraints - 1 ≤ records ≤ 500 - It is guaranteed that records contains lowercase English letters only."
Join thousands of developers practicing for Salesforce.