← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Practice/Meta/Leetcode 234. Palindrome Linked List
CodingMust
Given the head of a singly linked list, determine whether the values in the list form a palindrome. A palindrome reads the same forwards and backwards.
You need to return true if the linked list is a palindrome, and false otherwise.
[1, 100000][0, 1000000]Example 1:
Input: head = [1, 2, 2, 1] Output: true Explanation: The list reads the same forwards (1 → 2 → 2 → 1) and backwards (1 → 2 → 2 → 1)
Example 2:
Input: head = [1, 2] Output: false Explanation: Reading forwards gives 1 → 2, but backwards gives 2 → 1
Example 3:
Input: head = [1, 2, 3, 2, 1] Output: true Explanation: This odd-length list is symmetric around the middle element (3)