problem:
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3...
分类:
其他好文 时间:
2015-04-20 11:14:41
阅读次数:
131
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-04-20 11:01:21
阅读次数:
128
Vova was walking along one of Shenzhen streets when he noticed young pear trees, growing along the pavement. Each tree had a plaque attached to it containing some number. Vova walked around all n tree...
分类:
其他好文 时间:
2015-04-20 07:01:27
阅读次数:
256
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.采用二分递归。 1 class Solution { 2 public: 3 TreeNode *...
分类:
其他好文 时间:
2015-04-19 21:10:54
阅读次数:
173
来源: Backdoor CTF 2015 There is a wierd kind of authentication service running: nc hack.bckdr.in 8004. The binary can be found here. The vampire says t...
分类:
其他好文 时间:
2015-04-19 15:59:21
阅读次数:
194
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
给定一个充满0和1的矩阵,要求出范围全为1的矩阵的面积。
算法一,动态规划
此题,以每行为底,都可以转换成是一个Largest
Rec...
分类:
其他好文 时间:
2015-04-19 14:45:57
阅读次数:
115
public class Solution { public int findPeakElement(int[] num) { // binary search http://siddontang.gitbooks.io/leetcode-solution/content/arr...
分类:
其他好文 时间:
2015-04-19 14:34:05
阅读次数:
98
题目描述Given a binary tree, flatten it to a linked list in-place.For example,
Given
The flattened tree should look like:
本题也是考察二叉树和指针操作的题目。题目要求将一棵二叉树拉平为一个链表 。链表通过树节点的右子树相连,且展开的顺序为原来树的前序遍历。实现思路:
若节点n存...
分类:
其他好文 时间:
2015-04-18 23:48:59
阅读次数:
213
https://leetcode.com/problems/unique-binary-search-trees-ii/Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n...
分类:
其他好文 时间:
2015-04-18 23:18:39
阅读次数:
122
题目描述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 000000000...
分类:
其他好文 时间:
2015-04-18 22:02:38
阅读次数:
128