Palindrome linked list is a linked list that reads the same fromboth directions (direction 1: from head to tail; direction 2: fromtail to head.)
For example,
It is easy to detect if a doubly linked listis palindrome or not, as you may traverse from either direction.While detecting if a singly linked list ispalindrome or not involves some work, such as using recursion orexplicit LIFO data structure, say stack.
Test your code by passing both steps below.
step 1
expected output:
true
Check It!
step 2
exptected output:
truefalse
Palindrome linked list is a linked list that reads the same from both directions (direction 1: from head to tail; direct
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am