package
Version:
v1.6.5
Opens a new window with list of versions in this module.
Published: Mar 23, 2021
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
< Previous
Next >
Given the head
of a singly linked list, return true
if it is a palindrome.
Example 1:
Input: head = [1,2,2,1]
Output: true
Example 2:
Input: head = [1,2]
Output: false
Constraints:
- The number of nodes in the list is in the range
[1, 105]
.
0 <= Node.val <= 9
Follow up: Could you do it in
O(n)
time and
O(1)
space?
[Linked List]
[Two Pointers]
Similar Questions
- Palindrome Number (Easy)
- Valid Palindrome (Easy)
- Reverse Linked List (Easy)
Documentation
¶
ListNode - Definition for singly-linked list.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.