NeetCode #196LC-443MediumTwo Pointers
← Back to All Problems#196 · #443 · String Compression(压缩字符串)
📌 Problem Statement & Constraints
Given an array of characters
chars, compress it in place using run-length encoding: for each group of consecutive identical characters, write the character followed by the group length (omitted when the length is 1). Return the new length. Constraints: 1 <= chars.length <= 2000; chars[i] is a lowercase letter, uppercase letter, digit or symbol.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!