# Valid Palindrome II (Leetcode 680)

Problem Link: <https://leetcode.com/problems/valid-palindrome-ii/>

```python
class Solution:
    def validPalindrome(self, s: str) -> bool:
        def test(s):
            n=len(s)
            i=0
            j=n-1
            while(i<=j):
                if(s[i]==s[j]):
                    i+=1
                    j-=1
                else:
                    return False
            return True
        
        n=len(s)
        i=0
        j=n-1
        c=0
        
        while(i<=j):
            if(s[i]!=s[j]):
                t1=s[:i]+s[i+1:]
                t2=s[:j]+s[j+1:]
                if(test(t1) or test(t2)):
                    return True
                else:
                    return False
            else:
                i+=1
                j-=1
        
        return True       
```
