Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Palindrome Linked List

XPChallenge Points: 10
levelLevel: Easy

You are given the head of a singly linked list. Return true if the numbers form a palindrome (the same forward and backward). Otherwise, return false.

Example 1:

Input: head = [3,4,4,3]

Output: true

Explanation:

Forward = 3→4→4→3 and backward = 3→4→4→3.

Example 2:

Input: head = [5,6]

Output: false

Explanation:

Forward = 5→6, backward = 6→5, not the same.

Example 3:

Input: head = [7]

Output: true

Explanation:

A single element is always a palindrome.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result