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.
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.

Complete the function getMinArchiveOperations in the editor below.
getMinArchiveOperations has the following parameter: string records: the sequence of customer records in the Lightning Component
int: the minimum number of operations required to archive all records
Salesforce • Pending