#2716
Minimize String Length
newbie · 210 · lc easy +16 · 78.9% accepted · 375 likes · top 90%
Description
Given a string s, you may pick any character at position i and delete the nearest copy of that same character to its left or to its right (if one exists). Repeat any number of times to minimize s. Return the minimum possible length.
Code
1
2
3