摘要: Given a non-negative integer represented as non-empty a singly linked list of digits, plus one to the integer. You may assume the integer do not conta 阅读全文
posted @ 2017-01-23 14:26 lettuan 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2017-01-23 12:33 lettuan 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? 思路: 一开始我想到的方法伪码如下: while head不空: 阅读全文
posted @ 2017-01-23 12:18 lettuan 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- 阅读全文
posted @ 2017-01-23 02:31 lettuan 阅读(140) 评论(0) 推荐(0) 编辑