Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题解完全抄自ref的说明,感谢!“题解:先复习下什么是二叉搜索树(引自Wikipedia):二叉查找树(B...
分类:
其他 时间:
2015-06-10 06:33:03
收藏:
0 评论:
0 赞:
0 阅读:
186
超简洁的代码本来考虑是不是真的要每个点求一个maxDepth,看来是的哟public class Solution { public boolean isBalanced(TreeNode root) { if (root==null) return true; i...
分类:
其他 时间:
2015-06-10 06:32:53
收藏:
0 评论:
0 赞:
0 阅读:
173
就recursive做,简单题public class Solution { public int minDepth(TreeNode root) { if(root==null) return 0; if (root.left==null && root.righ...
分类:
其他 时间:
2015-06-10 06:32:43
收藏:
0 评论:
0 赞:
0 阅读:
254
leetcode中有几道题使用同一个思路,大致是先维护一个窗口,每次只移动窗口左侧或者右侧的边界,然后针对这个窗口内的元素进行处理。这种方式使用两个指针,可以将问题的运行时间降到O(n)内。Longest Substring Without Repeating Characters:https://...
分类:
其他 时间:
2015-06-10 06:32:23
收藏:
0 评论:
0 赞:
0 阅读:
190
题意:思路:#include#include#include#include#include#include#include#include#includeusing namespace std;struct Work{ __int64 c,d;};Work work[100000+10];i...
分类:
其他 时间:
2015-06-10 06:32:13
收藏:
0 评论:
0 赞:
0 阅读:
93
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 the farthest le...
分类:
其他 时间:
2015-06-10 06:32:03
收藏:
0 评论:
0 赞:
0 阅读:
272
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他 时间:
2015-06-10 06:31:53
收藏:
0 评论:
0 赞:
0 阅读:
208
简单题ref“使用的是先序遍历,算法的复杂度跟遍历是一致的,如果使用递归,时间复杂度是O(n),空间复杂度是O(logn)。” by codegankerhttp://blog.csdn.net/linhuanmars/article/details/22839819?Time to search ...
分类:
其他 时间:
2015-06-10 06:31:43
收藏:
0 评论:
0 赞:
0 阅读:
191
跟之前的解法一模一样Binary Tree Level Order Traversal I,II 不赘述public class Solution { public ArrayList> zigzagLevelOrder(TreeNode root) { ArrayList> r...
分类:
其他 时间:
2015-06-10 06:31:23
收藏:
0 评论:
0 赞:
0 阅读:
281
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他 时间:
2015-06-10 06:31:13
收藏:
0 评论:
0 赞:
0 阅读:
238
有个问题,就是不能和same tree一样光看root 做recursive而是必须比较左右节点,因为对称是指整个树否则就会出现 1 2 2 # 3 3public class Solution { public boolean isSymmetric(TreeNode root) { ...
分类:
其他 时间:
2015-06-10 06:30:53
收藏:
0 评论:
0 赞:
0 阅读:
216
Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or minus...
分类:
其他 时间:
2015-06-10 06:30:43
收藏:
0 评论:
0 赞:
0 阅读:
164
1.irb参数配置~/.irbrcIRB.conf[:PROMPT_MODE] = :SIMPLE #简化 irb 提示符,以及禁用一些烦人的自动缩进行为IRB.conf[:AUTO_INDENT_MODE] = false2.注释:#单行=begin......多行=end3.字符串字符串连接>....
分类:
其他 时间:
2015-06-10 06:30:33
收藏:
0 评论:
0 赞:
0 阅读:
172
导航栏高度获取1 self.navigationController.navigationBar.frame.size.height状态栏高度获取1 [UIApplication sharedApplication].statusBarFrame.size.height标签栏高度获取1 tabVie...
分类:
其他 时间:
2015-06-10 06:29:33
收藏:
0 评论:
0 赞:
0 阅读:
275
Problem Description“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩...
分类:
其他 时间:
2015-06-10 06:29:03
收藏:
0 评论:
0 赞:
0 阅读:
215
一、BrowsableAttribute 指定一个属性或者事件是否在“属性”窗口PropertyGrid显示,默认显示二、DisplayNameAttribute 指定一个属性或者事件在"属性"窗口PropertyGrid的显示名称三、CategoryAttribute 指定一个属性或者事件在...
分类:
其他 时间:
2015-06-10 06:27:34
收藏:
0 评论:
0 赞:
0 阅读:
173
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:
其他 时间:
2015-06-10 06:27:03
收藏:
0 评论:
0 赞:
0 阅读:
196
主外键是数据库提供的一种两表之间强制关联的方法,也可以从应用层实现。优点缺点数据库实现的主外键由数据库层机制保证,无需应用额外实现强关联,不易扩展变更应用实...
分类:
其他 时间:
2015-06-10 02:11:43
收藏:
0 评论:
0 赞:
0 阅读:
435
【压测环境】
操作系统:?Ubuntu 14.04 LTS
Linux版本:?3.13.0-24-generic?x86_64?GNU/Linux
处理器:?4核的?AMD Athlon(tm) II X4 640?Processor @?800MHz
机器内存:共 8GB,已使用 6GB,未使用 2GB,交换区 未使用
Redis版本:2.8.17
Redis内存:500MB
? ...
分类:
其他 时间:
2015-06-10 02:06:43
收藏:
0 评论:
0 赞:
0 阅读:
3688
集测的时候出现原来的功能不好使的情况(把我急死了);
手机号换绑(接口C)后,查询个人信息(接口I),显示的信息还是老的手机号.
后来看日志,发现接口C 和接口I 调用的ip不同,但是两个接口引用的是同一个常量啊?
我就突然想到了修改常量类之后,接口C 没有重新编译的问题.
为了确认这点,我找运维,请他把这两个接口的service ?class文件发给我,我使用jd-gui.exe 反编译 ...
分类:
其他 时间:
2015-06-10 02:04:13
收藏:
0 评论:
0 赞:
0 阅读:
216