上一页 1 ··· 7 8 9 10 11 12 13 下一页
摘要: Given a target integer T and an integer array A sorted in ascending order, find the index of the last occurrence of T in A or return -1 if there is no 阅读全文
posted @ 2018-02-25 00:18 davidnyc 阅读(202) 评论(0) 推荐(0)
摘要: Given a target integer T and an integer array A sorted in ascending order, find the index of the first occurrence of T in A or return -1 if there is n 阅读全文
posted @ 2018-02-25 00:08 davidnyc 阅读(208) 评论(0) 推荐(0)
摘要: Given a target integer T and an integer array A sorted in ascending order, find the index i such that A[i] == T or return -1 if there is no such index 阅读全文
posted @ 2018-02-24 23:53 davidnyc 阅读(137) 评论(0) 推荐(0)
摘要: (1) 先找中点(2) 再reverse后半段(3) 不用管两个子linked list的长度是否相等,从各个子链表的头开始一个一个比较。值不相等就返回false,相等就继续移动。 当取中点时,一定要 fast.next.next != null 阅读全文
posted @ 2018-02-24 10:13 davidnyc 阅读(163) 评论(0) 推荐(0)
摘要: 设:链表头是X,环的第一个节点是Y,slow和fast第一次的交点是Z。各段的长度分别是a,b,c,如图所示。环的长度是L。slow和fast的速度分别是qs,qf。 阅读全文
posted @ 2018-02-24 09:10 davidnyc 阅读(147) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/add-two-numbers/description/You are given two non-empty linked lists representing two non-negative integers.The digits are stored in reverse order and each of their nodes... 阅读全文
posted @ 2018-02-23 11:34 davidnyc 阅读(135) 评论(0) 推荐(0)
摘要: time: o(n) complexity: o(1) 阅读全文
posted @ 2018-02-23 10:06 davidnyc 阅读(104) 评论(0) 推荐(0)
摘要: 230,82,83 是一类题 time o(1) space o(1) 阅读全文
posted @ 2018-02-23 08:27 davidnyc 阅读(93) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return... 阅读全文
posted @ 2018-02-23 07:06 davidnyc 阅读(108) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/partition-list/description/ Given a linked list and a target value T, partition it such that all nodes less than T are l 阅读全文
posted @ 2018-02-23 02:38 davidnyc 阅读(116) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 下一页