摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?判断一个链表是否存在环,维护快慢指针就可以,如果有环那么快指针一定会追上慢指针,代码... 阅读全文
posted @ 2015-11-03 22:47 eversliver 阅读(216) 评论(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: a... 阅读全文
posted @ 2015-11-03 21:57 eversliver 阅读(235) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 注意题目要求合并 阅读全文
posted @ 2015-11-03 21:30 eversliver 阅读(328) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文
posted @ 2015-11-03 21:09 eversliver 阅读(327) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文
posted @ 2015-11-03 15:19 eversliver 阅读(271) 评论(0) 推荐(0) 编辑
摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文
posted @ 2015-11-03 11:53 eversliver 阅读(229) 评论(0) 推荐(0) 编辑