上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 33 下一页
摘要: 题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sin 阅读全文
posted @ 2015-08-28 10:32 Hygeia 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?... 阅读全文
posted @ 2015-08-28 09:23 Hygeia 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?AnalysisIf we have 2 pointers - fast an... 阅读全文
posted @ 2015-08-28 08:44 Hygeia 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For e... 阅读全文
posted @ 2015-08-28 07:46 Hygeia 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.题解... 阅读全文
posted @ 2015-08-27 23:56 Hygeia 阅读(178) 评论(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?碉堡!reference:http://www.cnblogs... 阅读全文
posted @ 2015-08-27 13:48 Hygeia 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题目:Sort a linked list inO(nlogn) time using constant space complexity.思路:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sort方法。... 阅读全文
posted @ 2015-08-27 13:39 Hygeia 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al... 阅读全文
posted @ 2015-08-26 11:41 Hygeia 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: ... 阅读全文
posted @ 2015-08-26 10:23 Hygeia 阅读(157) 评论(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 is1 -> 2 -> 3 ... 阅读全文
posted @ 2015-08-26 09:54 Hygeia 阅读(81) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 33 下一页