Leetcode 2781. Length of the Longest Valid Substring
Find the length of the longest contiguous substring of word that does not contain any string from forbidden as a substring; forbidden strings are short (≤10), so an efficient solution scans word while tracking the most recent index that yields a forbidden occurrence (checking only up to the max forbidden length).
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.