Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look like: 每个节点的右节点都是preor ...
分类:
其他好文 时间:
2018-12-31 17:24:40
阅读次数:
142
Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the first elem ...
分类:
其他好文 时间:
2018-12-27 18:50:35
阅读次数:
105
We are given head, the head node of a linked list containing unique integer values. We are also given the list G, a subset of the values in the linked ...
分类:
其他好文 时间:
2018-12-27 18:41:01
阅读次数:
107
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], wh ...
分类:
其他好文 时间:
2018-12-27 15:15:45
阅读次数:
113
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 not the ...
分类:
其他好文 时间:
2018-12-27 15:13:30
阅读次数:
134
Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: time: O(n), space: O(1) ...
分类:
其他好文 时间:
2018-12-27 10:23:57
阅读次数:
118
Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list ...
分类:
其他好文 时间:
2018-12-27 10:23:44
阅读次数:
144
Convert a BST to a sorted circular doubly-linked list in-place. Think of the left and right pointers as synonymous to the previous and next pointers i ...
分类:
其他好文 时间:
2018-12-27 10:23:29
阅读次数:
178
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to ...
分类:
其他好文 时间:
2018-12-26 20:16:04
阅读次数:
136
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * };1. 。*/struct ListNode* reverseBetween(struct List ...
分类:
其他好文 时间:
2018-12-26 01:12:29
阅读次数:
154