ElasticSoftware Engineer · Phone ScreenCodemia practiceOptimize compression for without recursion
Given a string, implement a function to optimize its compression by replacing consecutive repeated characters with a single character followed by the count of repetitions, without using recursion. The function should take a string as input and return the compressed string as output, ensuring that the output is shorter than the original string when possible.
Medium
Coding & Algorithms