【118-Pascal’s Triangle(帕斯卡三角形)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given numRows, generate the first numRows of Pascal’s triangle.
For example, given numRows = 5,
Return[
[1],
[1,1],...
分类:
编程语言 时间:
2015-08-13 07:48:37
阅读次数:
220
【119-Pascal’s Triangle II(帕斯卡三角形II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given an index k, return the kth row of the Pascal’s triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Co...
分类:
编程语言 时间:
2015-08-13 07:48:37
阅读次数:
176
【117-Populating Next Right Pointers in Each Node(二叉树链接右指针II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Follow up for problem “Populating Next Right Pointers in Each Node”.
What if the given tree could b...
分类:
编程语言 时间:
2015-08-13 07:47:20
阅读次数:
156
在两个集合(万级别的数据量)中,找出相同的元素,并保存到一个集合中。 第一反应:两重循环解决问题,对,问题是可以解决,但是通过小括号中的提示可以看出,明显是在考效率的问题。 所以这种O(n^2)的时间复杂度...
分类:
编程语言 时间:
2015-08-12 13:27:48
阅读次数:
148
【116-Populating Next Right Pointers in Each Node(二叉树链接右指针)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;...
分类:
编程语言 时间:
2015-08-12 07:51:31
阅读次数:
161
【113-Path Sum II(路径和II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.
For example:
Given the below b...
分类:
编程语言 时间:
2015-08-12 07:49:38
阅读次数:
150
【110-Balanced Binary Tree(平衡二叉树)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary...
分类:
编程语言 时间:
2015-08-11 08:34:51
阅读次数:
252
【112-Path Sum(路径和)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given...
分类:
编程语言 时间:
2015-08-11 08:34:13
阅读次数:
147
【111-Minimum Depth of Binary Tree(二叉树的最小深度)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from t...
分类:
编程语言 时间:
2015-08-11 08:33:30
阅读次数:
128
【107-Binary Tree Level Order Traversal II(二叉树层序遍历II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right,...
分类:
编程语言 时间:
2015-08-10 08:17:39
阅读次数:
169