Palindrome Linked List Problem Statement

Determine if a given singly linked list of integers is a palindrome. Return true if it is a palindrome, otherwise return false.

Example:

Input:
1 -> 2 -> 3 -> 2 -> 1 -> NULL
Output:
true
Explanation:

The linked list reads the same forwards and backwards, hence it is a palindrome.

Follow Up:

Can you solve the problem in O(N) time complexity and O(1) space complexity iteratively?

Input:

The first line contains an integer 'T' representing the number of test cases. Each test case consists of a single line with elements of the linked list separated by spaces, ending with -1. The -1 is not part of the list.

Output:

For each test case, output “true” or “false” on a new line.

Constraints:

  • 1 <= T <= 10
  • 0 <= L <= 105
  • 1 <= data <= 109 and data != -1

Where L is the number of nodes in the linked list.

Time Limit: 1 sec

AnswerBot
4mo

Check if a given singly linked list of integers is a palindrome.

  • Use two pointers to find the middle of the linked list.

  • Reverse the second half of the linked list.

  • Compare the first half with the revers...read more

Help your peers!
Select
Add answer anonymously...

Yodlee Software Engineer interview questions & answers

A Software Engineer was asked Q. Write a program for snake traversal of a binary tree.
A Software Engineer was asked Q. Write code to check if a linked list is a palindrome in a single traversal and w...read more
A Software Engineer was asked Q. Can you explain OOPS concepts like abstraction, encapsulation, inheritance, and ...read more

Popular interview questions of Software Engineer

A Software Engineer was asked Q1. Write a program for snake traversal of a binary tree.
A Software Engineer was asked Q2. Write code to check if a linked list is a palindrome in a single traversal and w...read more
A Software Engineer was asked Q3. Can you explain OOPS concepts like abstraction, encapsulation, inheritance, and ...read more
Yodlee Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits