Is Palindrome
In this lesson, we'll learn how to determine whether a singly linked list is a palindrome or not.
In this lesson, we investigate how to determine if a singly linked list is a palindrome, that is if the data held at each of the nodes in the linked list can be read forward from the head or backward from the tail to generate the same content. We will code the solution to both of these approaches in Python.
First of all, let’s learn what a palindrome is. A palindrome is a word or a sequence that is the same from the front as from the back. For instance, racecar and radar are palindromes. Examples of non-palindromes are ABC, hello, and test.
For this lesson, we’ll solve the Is Palindrome problem in Python by using three solutions.
Now let’s go ahead and check out Solution 1:
Solution 1: Using a string #
Implementation #
Get hands-on with 1400+ tech skills courses.