上一页 1 ··· 5 6 7 8 9 10 11 12 下一页
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文
posted @ 2016-09-13 11:43 咖啡中不塌缩的方糖 阅读(160) 评论(0) 推荐(0)
摘要: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2016-09-13 11:13 咖啡中不塌缩的方糖 阅读(160) 评论(0) 推荐(0)
摘要: Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on 阅读全文
posted @ 2016-09-13 10:35 咖啡中不塌缩的方糖 阅读(132) 评论(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: begin to in 阅读全文
posted @ 2016-09-13 09:49 咖啡中不塌缩的方糖 阅读(151) 评论(0) 推荐(0)
摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 最简单的思路是利用之前Merge 2 sorted Lists, 逐个相加,但是这种的时间复杂度会更高 阅读全文
posted @ 2016-09-13 09:36 咖啡中不塌缩的方糖 阅读(124) 评论(0) 推荐(0)
摘要: Sort a linked list in O(n log n) time using constant space complexity. O(n lg n) constant space的常见sort方法有 merge sort, quick sort, heap sort。 quick sor 阅读全文
posted @ 2016-09-13 09:20 咖啡中不塌缩的方糖 阅读(121) 评论(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 @ 2016-09-13 08:46 咖啡中不塌缩的方糖 阅读(85) 评论(0) 推荐(0)
摘要: Reverse a singly linked list. 解法: linked list 最典型的题型之一。 思路相同,也可以不用哨兵: 阅读全文
posted @ 2016-09-13 08:40 咖啡中不塌缩的方糖 阅读(110) 评论(0) 推荐(0)
摘要: Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in 阅读全文
posted @ 2016-09-12 07:19 咖啡中不塌缩的方糖 阅读(133) 评论(0) 推荐(0)
摘要: You are given a m x n 2D grid initialized with these three possible values. Fill each empty room with the distance to its nearest gate. If it is impos 阅读全文
posted @ 2016-09-12 01:06 咖啡中不塌缩的方糖 阅读(169) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 下一页