Practice Longest Common Prefix Between Adjacent Strings After Removals
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
For each index i independently, remove words[i] and measure the common-prefix length of every adjacent pair remaining. Return the largest of those lengths, or zero if there is no adjacent pair or all lengths are zero. Collect one result per original index.
Source: Longest Common Prefix Between Adjacent Strings After Removals on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
words = ["jump","run","run","jump","run"]
[3,0,0,3,3]
# Example 2
words = ["dog","racer","car"]
[0,0,0]
Constraints
Related LeetCode Problems
Practice more problems similar to Longest Common Prefix Between Adjacent Strings After Removals.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.