Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.