Palindrome Linked List(leetcode234)

Given a singly linked list, determine if it is a palindrome.

Example 1:

Input: 1->2
Output: false

Example 2:

Input: 1->2->2->1
Output: true

Follow up:
Could you do it in O(n) time and O(1) space?

要不把List反过来试试

git:https://github.com/woshiyexinjie/leetcode-xin

猜你喜欢

转载自my.oschina.net/u/2277632/blog/2986430