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...
分类:
其他好文 时间:
2014-06-28 10:07:19
阅读次数:
208
题目:输入一棵二叉树的根节点,求该树的深度题解分析:二叉树具有天然的递归性,首先应该想递归解法/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNod...
分类:
其他好文 时间:
2014-06-27 15:58:59
阅读次数:
206
方法一:由于生成的exe文件在bin\debug目录下,可以使用向上查找目录的方式获取要读取的xml文件string haarXmlPath = @"../../haarcascade_frontalface_alt_tree.xml";FileInfo file = new FileInfo(f....
汉字转拼音的库主要是:pinyin https://github.com/hotoo/pinyinPYMethod https://github.com/a85816841/PotentialGragonSnail/tree/master/ql/lib/pinyingPOAPinyin h...
分类:
移动开发 时间:
2014-06-27 13:31:58
阅读次数:
232
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:
其他好文 时间:
2014-06-27 12:30:39
阅读次数:
204
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
分类:
其他好文 时间:
2014-06-27 12:11:09
阅读次数:
181
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the tota...
分类:
其他好文 时间:
2014-06-27 09:53:29
阅读次数:
208
题目大意:
分析长度为n的子串有多少种。
思路分析:
对于没出现的字符,将其分配一个数字。
然后将子串看做一个nc进制的数。
然后hash判断。
#include
#include
#include
#include
#include
#include
using namespace std;
bool vis[26666666];
int val[30...
分类:
其他好文 时间:
2014-06-27 09:45:35
阅读次数:
184
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 nodes with keys less than the node's key....
分类:
其他好文 时间:
2014-06-27 09:15:12
阅读次数:
196
目前分词性能比较差,只有1.65M/s,同事在没有改变主要算法的情况下做了一点优化调整,到3.52M/s,但对性能的提升仍然不够明显。我感觉亟须解决几个问题:
1.search时keyword分词也按多种粒度进行,然后分别sloppyphrase,最后or起来,由于大粒度分的词词频低,因此idf大,它们在排序时优先级更高,符合期望。现在只做一个粒度的切法,又要求在索引里面都能找到,感觉不太现实。...
分类:
其他好文 时间:
2014-06-27 07:07:34
阅读次数:
203