Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r ...
分类:
其他好文 时间:
2017-10-24 13:06:04
阅读次数:
132
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th ...
分类:
其他好文 时间:
2017-10-24 11:33:52
阅读次数:
128
000 - search tree 002 -- count the nodes in the tree 003 -- compare 2 binary trees 004 - degree check of the tree 005- find a element in the binary se ...
分类:
其他好文 时间:
2017-10-23 21:48:19
阅读次数:
229
Traceback (most recent call last): File "./se3.py", line 16, in <module> dr=webdriver.Firefox(firefox_binary=binary,executable_path=driver_path) File ...
分类:
其他好文 时间:
2017-10-23 15:05:03
阅读次数:
223
本题是一个二叉树问题——Perfect Binary Tree。 一个完美二叉树(PBT)的深度为D,从根结点开始,按层次遍历顺序编号为1,2,...,2D-1。 有若干个球,依次由根结点落下。当一个球落在非叶结点上时,将向左子树或右子树落下。这个方向由每一个结点的flag控制(其中,flag是一个 ...
分类:
其他好文 时间:
2017-10-23 01:14:18
阅读次数:
153
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n ...
分类:
其他好文 时间:
2017-10-22 23:32:59
阅读次数:
154
树状数组的原理和实现 概念 树状数组或者二叉索引树也称作Binary Indexed Tree,又叫做Fenwick树;它的查询和修改的时间复杂度都是log(n),空间复杂度则为O(n),这是因为树状数组通过将线性结构转化成树状结构,从而进行跳跃式扫描。通常使用在高效的计算数列的前缀和,区间和。 其 ...
分类:
编程语言 时间:
2017-10-22 22:18:15
阅读次数:
226
1 #include"iostream.h" 2 3 int BinarySearch(int a[],int left,int right,const int& x) 4 { 5 if(left<right) 6 { 7 int middle = (left+right)/2; 8 if(x==a ...
分类:
其他好文 时间:
2017-10-22 22:02:19
阅读次数:
139
nvert a binary tree. to 方法二:BfS ...
分类:
其他好文 时间:
2017-10-22 21:50:03
阅读次数:
179
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet ...
分类:
其他好文 时间:
2017-10-22 21:47:15
阅读次数:
163