> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0680_valid_palindrome_ii/slt.md).

# Solution1 双指针

* 时间复杂度 $O(n)$

  &#x20; 虽然在 while 里验证回文，但实际最多验证两次
* 空间复杂度 $O(1)$

如果一次 s\[l] != s\[r] 都没遇到，则返回 true 如果遇到 s\[l] != s\[r]，则分别删除左右两边，只要有一个满足就行
