1. Valid palindrome

Algorithm:
  1. Initialize two pointers, left at the start and right at the end of the string.
  2. Iterate until the left pointer is before the right pointer, skipping non-alphanumeric characters for both pointers.
  3. Compare characters positioned at the left and right pointers in lowercase; if they differ, return FALSE.
  4. Move left forward and right backward to check the next pair of characters.
  5. If the traversal completes without mismatches, return TRUE indicating the string is a palindrome.

valid palindrome


Python code:



Comments

Popular posts from this blog

1. Repeated DNA Sequences

Top K Elements