Is the Linked List a Palindrome
Updated
Problem statement
A singly linked list stores a word, one lowercase letter per node. Because list nodes here hold integers, each node holds the character code of its letter: 'a' is 97, 'b' is 98, and so on up to 'z', 122.
Given the head of the list, return true if the word is a palindrome (it reads the same from front to back and from back to front), and false otherwise.
Function
isPalindromeList(head: ListNode) → booleanExamples
Example 1
head = [108,101,118,101,108]return = trueThe codes spell level (108 is l, 101 is e, 118 is v). Read backward it is the same word, so the answer is true.
Example 2
head = [97,98,99,97]return = falseThe codes spell abca. The outer letters match (a and a), but the inner pair b and c does not, so the answer is false.
Example 3
head = [110,111,111,110]return = trueThe codes spell noon, an even-length word that reads the same both ways. The answer is true.
Constraints
- The list has
1to1000nodes. 97 <= Node.val <= 122(the codes of the letters'a'to'z')
More Adobe Phone Screen questions
- Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
- All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
- Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
- Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
- Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
- Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
- Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
- Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026
Similar questions at other companies
- Middle of a Linked ListCisco · PHONE SCREENCisco interview questions
- Merge Two Sorted ListsIBM · PHONE SCREENIBM interview questions
- Count Nodes in a ChainApple · PHONE SCREENApple interview questions
- Detect a Cycle in a Linked ListSalesforce · PHONE SCREENSalesforce interview questions
- Find the Intersection Node of Two Linked ListsVisa · PHONE SCREENVisa interview questions
- Reverse a Linked ListMygate · PHONE SCREENMygate interview questions
- Find the Intersection Node of Two Linked ListsLinkedIn · PHONE SCREENLinkedIn interview questions
- Linked List Palindrome in Constant SpaceNVIDIA · PHONE SCREENNVIDIA interview questions
- Reverse a Singly Linked ListBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Merge Two Sorted Linked ListsExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions