欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
...
分类:
其他好文 时间:
2015-02-17 10:26:42
阅读次数:
140
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to...
分类:
其他好文 时间:
2015-02-17 10:25:14
阅读次数:
168
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which th...
分类:
其他好文 时间:
2015-02-17 10:24:07
阅读次数:
135
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Same Tree
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and ...
分类:
其他好文 时间:
2015-02-16 14:19:42
阅读次数:
98
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple...
分类:
其他好文 时间:
2015-02-16 11:45:12
阅读次数:
120
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
R...
分类:
其他好文 时间:
2015-02-16 11:45:05
阅读次数:
191
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Linked List Cycle
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
一开始使用了复杂度O(n^2)的方法,但是超时了,使用两个指...
分类:
其他好文 时间:
2015-02-16 11:43:26
阅读次数:
140
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:
Can you solve it without using extra space?扩展问题
在...
分类:
其他好文 时间:
2015-02-16 11:42:22
阅读次数:
175
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Insertion Sort List
Sort a linked list using insertion sort.
class Solution {
public:
ListNode *insertionSortList(ListNode *head) {
if( head==NULL || ...
分类:
其他好文 时间:
2015-02-15 12:12:01
阅读次数:
175
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,
ret...
分类:
其他好文 时间:
2015-02-15 10:49:55
阅读次数:
163