Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 0000000000000...
分类:
其他好文 时间:
2015-06-05 10:13:12
阅读次数:
133
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr...
分类:
其他好文 时间:
2015-06-05 06:23:58
阅读次数:
298
Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3...
分类:
编程语言 时间:
2015-06-04 22:33:35
阅读次数:
133
Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,...
分类:
编程语言 时间:
2015-06-04 22:23:54
阅读次数:
210
$arr = array(4,58,11,34,88,45,32,54,63,78);function binary($arr,$bnum){ if(is_array($arr) && count($arr) > 0) { sort($arr); $start = 0; $end = coun...
分类:
其他好文 时间:
2015-06-04 13:21:10
阅读次数:
91
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please note that the...
分类:
其他好文 时间:
2015-06-04 12:00:19
阅读次数:
109
Maximal Square问题:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.思路: 动态规划我的代码:public....
分类:
其他好文 时间:
2015-06-04 11:45:38
阅读次数:
85
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...
分类:
其他好文 时间:
2015-06-04 11:36:24
阅读次数:
97
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr...
分类:
其他好文 时间:
2015-06-04 00:56:05
阅读次数:
132
考察点广度优先遍历--层次遍历STL内容器的用法广度优先遍历的时候,首先应该想到的就是借助于队列。还需要在遍历下一层之前保存当前层节点的数量代码很简单:class Solution {public: vector > levelOrderBottom(TreeNode* root) { ...
分类:
编程语言 时间:
2015-06-03 23:18:56
阅读次数:
290