2018年3月26日

一个链表,奇数位升序偶数位降序,让链表变成升序的

摘要: 题目描述:一个链表,奇数位升序偶数位降序,让链表变成升序的。比如:1 8 3 6 5 4 7 2 9,最后输出1 2 3 4 5 6 7 8 9。分析:这道题可以分成三步:首先根据奇数位和偶数位拆分成两个链表。然后对偶数链表进行反转。最后将两个有序链表进行合并。 阅读全文

posted @ 2018-03-26 18:07 lina2014 阅读(1071) 评论(0) 推荐(0) 编辑

LeetCode 046 Permutations 全排列

摘要: Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1, 阅读全文

posted @ 2018-03-26 17:31 lina2014 阅读(283) 评论(0) 推荐(0) 编辑

LeetCode 128 Longest Consecutive Sequence 一个无序整数数组中找到最长连续序列

摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest 阅读全文

posted @ 2018-03-26 17:07 lina2014 阅读(219) 评论(0) 推荐(0) 编辑

LeetCode 024 Swap Nodes in Pairs 交换链表中相邻的两个节点

摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your alg 阅读全文

posted @ 2018-03-26 16:42 lina2014 阅读(105) 评论(0) 推荐(0) 编辑

导航