Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.这题和sort list等题都比较相似,需要先用快慢指针的方法找到链表的中点,然后...
分类:
其他好文 时间:
2014-10-16 22:31:43
阅读次数:
217
4487. Can you answer these queries VIProblem code: GSS6Given a sequence A of N(N #include#include#include#include#include#include#include#include#incl...
分类:
其他好文 时间:
2014-10-16 22:05:13
阅读次数:
163
【前言】TTvTT先让我呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜一下。。。。。。经历了5发WA,6发RE,3发TLE后,今天终于和这道题做了个了断了。题意:一棵树,给出边权值,有两种操作:更改一条边的值;查找a到b路径上的最大边权值。【唧唧喳喳】这道题算是树链剖分对边剖分的一道很好的训练题吧,但是数据好像比较...
分类:
其他好文 时间:
2014-10-13 10:47:59
阅读次数:
253
【题目】
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 the depth of the two subtrees of every node never d...
分类:
其他好文 时间:
2014-10-12 22:29:28
阅读次数:
210
问题: 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 the ...
分类:
其他好文 时间:
2014-10-12 17:56:48
阅读次数:
154
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:
其他好文 时间:
2014-10-12 07:47:07
阅读次数:
168
判断给定的二叉树是否是平衡二叉树,即每一个节点的深度相差不大于1...
分类:
其他好文 时间:
2014-10-10 01:29:03
阅读次数:
194
[leetcode]Given a binary tree, determine if it is height-balanced....
分类:
其他好文 时间:
2014-10-09 16:25:48
阅读次数:
132
[leetcode]Given an array where elements are sorted in ascending order, convert it to a height balanced BST....
分类:
其他好文 时间:
2014-10-08 10:09:55
阅读次数:
164
8372. Triple SumsProblem code: TSUMYou're given a sequencesofNdistinct integers.Consider all the possible sums of three integers from the sequence at ...
分类:
其他好文 时间:
2014-10-07 17:31:33
阅读次数:
407