FrontendX
Minimum Trim Length String
medium
Description
AI Assistance
Solution
Test Cases
Test Result
Submissions
Canvas
Minimum Trim
Length String
Remove matching prefix and suffix repeatedly using two pointers.
Examples
Example 1
Input:
[1,2,3]
Output:
3
Example 2
Input:
[1,2,3]
Output:
3
Hints
Hint 1
Use two pointers at start and end.
Hint 2
Check matching prefix/suffix pairs.
Hint 3
Remove matched pairs and continue.
Minimum Trim Length String
Remove matching prefix and suffix repeatedly using two pointers.