Leetcode 1003. Check If Word Is Valid After Substitutions
Determine whether a string of 'a', 'b', 'c' can be formed from an empty string by repeatedly inserting the substring "abc" (equivalently, whether s can be reduced to empty by repeatedly deleting "abc" substrings). The core challenge is efficiently detecting and removing "abc" patterns (e.g., via an online suffix/stack check) for |s| ≤ 2·10^4.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid June, 2026
Intern
you are given a string and you need to verify if it valid or not
Hello Interview Premium
Your account is free and you can post anonymously if you choose.