NetflixSoftware Engineer · Phone ScreenCodemia practiceOptimize compression for in-place
Given a string of characters, implement an in-place algorithm to optimize the compression of the string such that consecutive repeated characters are replaced by a single instance of the character followed by the count of repetitions. The function should return the length of the compressed string and modify the input string to reflect the compressed form. For example, given the input "aabbcc", the output should be 6, and the modified string should be "a2b2c2".