CodingMedium
Lexicographically Smallest String Based on Substring Conditions
Filed under WheelsEye
The question
Given string S1 of length L1 and string S2 of length L2 consisting of 'T' and 'F', generate the lexicographically smallest string S such that a substring of length L1 starting at index i equals S1 if and only if the ith element of S2 is 'T'. Return -1 if not possible.
No write-up yet. Related questions below have one.
Related WheelsEye questions
Collected from public candidate posts and coding forums. Updated Nov 2026.