shlogg · Early preview
Md Ariful Haque @mah-shamim

Minimum Length Of String After Operations

Delete closest matching chars from left & right to minimize string length. Focus on char freqs: reduce >=3 to <=2, sum remaining counts.

3223. Minimum Length of String After Operations
Difficulty: Medium
Topics: Hash Table, String, Counting
You are given a string s.
You can perform the following process on s any number of times:

Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one character to the right that is also equal to s[i].
Delete the closest character to the left of index i that is equal to s[i].
Delete the closest character to the right of index i that is equal to s[i].

Return the minimum length of the final string s that you can achi...