https://leetcode.com/problems/counting-bits/ 给定一个非负数n,输出[0,n]区间内所有数的二进制形式中含1的个数 Example: For num = 5 you should return [0,1,1,2,1,2]. 注意fellow up部分,题目 ...
分类:
其他好文 时间:
2016-12-26 14:03:32
阅读次数:
159
算法:在无序的栈里面,求出这个数组排序后的任意两个相邻元素的最大差值. ...
分类:
其他好文 时间:
2016-12-18 12:19:55
阅读次数:
245
338. Counting Bits 原题链接https://leetcode.com/problems/counting-bits/ 自己的思路:Integer.bitCount()方法,但是原题并不推荐使用内嵌方法 bug free:遇到偶数时,其1的个数和该偶数除以2得到的数字的1的个数相同, ...
分类:
其他好文 时间:
2016-12-14 22:07:38
阅读次数:
189
Counting Offspring Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description You are given a tree, it’s ro ...
分类:
编程语言 时间:
2016-12-05 19:41:01
阅读次数:
217
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 ...
分类:
其他好文 时间:
2016-12-04 07:57:06
阅读次数:
166
题目链接:http://vjudge.net/problem/UVA-1225 #include <iostream> #include <cstring> #include <cstdio> using namespace std; int f[10000][10]; int main() { m ...
分类:
其他好文 时间:
2016-12-03 10:03:43
阅读次数:
349
Time Complexity: O(N) The depth of the directory/file is calculated by counting how many "\t"s are there.The time complexity is O(n) because each subs ...
分类:
其他好文 时间:
2016-11-30 07:47:50
阅读次数:
187
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 ...
分类:
其他好文 时间:
2016-11-30 02:31:27
阅读次数:
178
1115 题目:二叉排序树,统计最后两层节点个数 思路:数组格式存储,insert建树,dfs遍历 #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> using namespace std; typed ...
分类:
编程语言 时间:
2016-11-26 02:37:35
阅读次数:
219
17997 Simple Counting 时间限制:2000MS 内存限制:65535K提交次数:0 通过次数:0 题型: 编程题 语言: 不限定 Description 输入格式 The first line of the input is an integer T , indicates th ...
分类:
其他好文 时间:
2016-11-14 01:20:57
阅读次数:
185