Search
⌘K

Leetcode 1750. Minimum Length of String After Deleting Similar Ends

Given a string of 'a', 'b', and 'c', repeatedly delete a non-empty prefix and non-empty suffix that are runs of the same character and equal to each other (without overlapping) and return the minimum possible remaining length. This is a two-pointer/greedy problem of shrinking matching uniform ends until characters differ or the pointers cross (n up to 1e5).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.