816. Longest Common Prefix After at Most One Removal
You are provided two strings s and t.
Return the length of the longest common prefix between s and t after deleting at most one character from s.
Note: It is allowed to leave s unchanged.
Example 1:
Input: s = "forxward" , t = "forward"
Output: 7
Explanation:
Removing s[3] from s results in "forward", which has a longest common prefix of length 7 with t.
Example 2:
Input: s = "take" , t = "take"
Output: 4
Explanation:
No removal is needed.
Now Your Turn!
Pick the correct output for the given inputInput: s = "madxa" , t = "madam"
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= s.length <= 105
- 1 <= t.length <= 105
- s and t contain only lowercase English letters