Leetcode 2645. Minimum Additions to Make Valid String
Given a string over {a,b,c}, compute the minimum number of insertions needed to turn it into a concatenation of "abc" blocks by aligning its characters to the cyclic pattern "a"→"b"→"c". The core challenge is pattern matching against this fixed cycle — solvable by a simple greedy scan that counts missing letters for each expected position.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.