1. /**
    2. * https://leetcode-cn.com/problems/reverse-vowels-of-a-string/
    3. * 回文字符串 #680
    4. * 可以删除一个字符,判断是否能构成回文字符串。
    5. * Input: "abca"
    6. * Output: True
    7. * Explanation: You could delete the character 'c'.
    8. * 参考链接: https://github.com/CyC2018/CS-Notes/blob/master/notes/Leetcode%20%E9%A2%98%E8%A7%A3%20-%20%E5%8F%8C%E6%8C%87%E9%92%88.md#4-%E5%9B%9E%E6%96%87%E5%AD%97%E7%AC%A6%E4%B8%B2
    9. * **/
    10. function validPalindrome(s) {
    11. for (let i = 0, j = s.length - 1; i < j; i++, j--) {
    12. if (s[i] != s[j]) {
    13. return _isPlalindrome(s, i, j - 1) || _isPlalindrome(s, i + 1, j)
    14. }
    15. }
    16. return true
    17. }
    18. function _isPlalindrome(s, i, j) {
    19. while (i < j) {
    20. if (s[i++] != s[j--]) {
    21. return false
    22. }
    23. }
    24. return true;
    25. };
    26. console.log(validPalindrome('deeee'))