今際の国の呵呵君
Wednesday, September 27, 2017
[LeetCode]Palindrome Linked List
不允许我们用额外的空间,那么stack和递归都不能用。我们只好reverse linkedlist的后一半,然后进行比较。时间复杂度O(n),常数空间,代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment