NeetCode #771LC-3223MediumGreedy
← Back to All Problems

#771 · #3223 · Minimum Length of String After Operations(操作后字符串的最短长度)

📌 Problem Statement & Constraints

Given a string s, an operation picks an index i and a character c equal to s[i] that appears both to the left and to the right of i, then deletes the closest such occurrence on each side. Return the minimum length of s after any number of operations. Constraints: 1 <= s.length <= 2 * 10^5, s consists of lowercase English letters.
🔒

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!