234. Palindrome Linked List Leetcode Solution

Palindrome Linked List Leetcode Problem :

Given the head of a singly linked list, return true if it is a palindrome or false otherwise.

jump game leetcode

Palindrome Linked List Leetcode Solution :

Constraints :

  • The number of nodes in the list is in the range [1, 105].
  • 0 <= Node.val <= 9

Example 1:

  • Input: head = [1,2]
  • Output: false

Approach :

  1. Initialise an ArrayList for storing LinkedList vals
  2. Loop over input LinkedList and store vals in ArrayList
  3. Apply Simple two pointer approach on ArrayList start checking starting and ending vals
  4. If they are not equal return false else start++, end–
  5. If none of the iteration hits above condition given LinkedList is a Palindrome LinkedList

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Code :

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription