String Compression In Place
Asked at Amazon · Coding Questions · Difficulty: Medium
Given a list of characters `chars`, compress it in place: replace each run of a repeated character by the character followed by the run length (lengths > 1 written as their decimal digits). Return the new length; `chars` up to that length holds the compressed form.
Loading the problem…