Leetcode 3598. Longest Common Prefix Between Adjacent Strings After Removals
For each index i, remove words[i] and return the length of the longest common prefix among all adjacent pairs in the remaining array (0 if no adjacent pairs share a prefix). The core challenge is to precompute LCPs of original adjacent pairs and answer n queries efficiently by taking the maximum over pairs not touching the removed index (requiring range-max support to meet the 1e5-size constraints).
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.