VALID PALINDROME II [PYTHON]

Sdílet
Vložit
  • čas přidán 18. 02. 2022
  • In this video we are solving Leetcode problem # 680: Valid Palindrome II. This is the follow up to the problem Valid Palindrome except we are allowed to remove at most one character in an attempt to make the string a valid palindrome.
    The approach will be the same in that we try to use two pointers and check whether the characters at the indexes corresponding to those pointers match. If they do, we can continue through the string, if they do not, then we try to see if the string is a valid palindrome if we remove the character at the ith index or the jth index.

Komentáře •