二叉树结构变化 例 lintcode 453. Flatten Binary Tree to Linked List https://www.lintcode.com/problem/flatten-binary-tree-to-linked-list/ traversal :因为是按照前序遍历的顺 ...
分类:
其他好文 时间:
2020-02-05 10:04:59
阅读次数:
68
一、技术总结 1. 这个也是一个链表类题目,主要是在结构提上的设计,可以设计一个flag参数用于记录真实有效的结点。 2. 然后就是根据题目要求进行排序,输出结果。 3. cmp()函数可以,一层是把有效节点排到数组的左边,然后可以进行二次比较,按题目要求来。 二、参考代码 ...
分类:
其他好文 时间:
2020-02-03 19:13:12
阅读次数:
64
86. Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You s ...
分类:
其他好文 时间:
2020-02-03 09:43:53
阅读次数:
69
82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from ...
分类:
其他好文 时间:
2020-02-02 12:06:41
阅读次数:
68
1 """ 2 Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and ...
分类:
其他好文 时间:
2020-02-01 23:19:31
阅读次数:
69
1 """ 2 Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. 3 4 Afte ...
分类:
其他好文 时间:
2020-02-01 23:18:44
阅读次数:
83
1 """ 2 We are given a linked list with head as the first node. Let's number the nodes in the list: node_1, node_2, node_3, ... etc. 3 4 Each node may ...
分类:
其他好文 时间:
2020-02-01 23:17:32
阅读次数:
75
1 """ 2 We are given head, the head node of a linked list containing unique integer values. 3 4 We are also given the list G, a subset of the values i ...
分类:
其他好文 时间:
2020-02-01 23:05:58
阅读次数:
64
61. Rotate List Given a linked list, rotate the list to the right by k places, where k is non negative. Example 1: Example 2: 思路:首先算出链表的长度(因为平移的时候以长度为 ...
分类:
其他好文 时间:
2020-01-31 18:46:14
阅读次数:
49