Leetcode 680. Valid Palindrome II

easy

Example 1:

Input: s = “aba”
Output: true
Example 2:

Input: s = “abca”
Output: true
Explanation: You could delete the character ‘c’.
Example 3:

Input: s = “abc”
Output: false

class Solution {
public:
bool sub(int i, int j, string& s) {
while(j>i) {
if (s[i] == s[j]) {
i++…