摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
posted @ 2016-03-19 09:55 YuriFLAG 阅读(285) 评论(0) 推荐(0)
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: For example, Consider the followi 阅读全文
posted @ 2016-03-19 07:46 YuriFLAG 阅读(165) 评论(0) 推荐(0)
摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2016-03-18 08:50 YuriFLAG 阅读(132) 评论(0) 推荐(0)
摘要: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2016-03-18 08:46 YuriFLAG 阅读(147) 评论(0) 推荐(0)
摘要: Invert a binary tree. 阅读全文
posted @ 2016-03-17 09:11 YuriFLAG 阅读(128) 评论(0) 推荐(0)
摘要: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \2 3 \ 5 All root-to-leaf paths are: 阅读全文
posted @ 2016-03-17 09:02 YuriFLAG 阅读(143) 评论(0) 推荐(0)
摘要: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2016-03-16 22:25 YuriFLAG 阅读(115) 评论(0) 推荐(0)
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / 阅读全文
posted @ 2016-03-16 08:20 YuriFLAG 阅读(156) 评论(0) 推荐(0)
摘要: 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 sum. F 阅读全文
posted @ 2016-03-15 22:08 YuriFLAG 阅读(123) 评论(0) 推荐(0)
摘要: 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 { 阅读全文
posted @ 2016-03-13 22:35 YuriFLAG 阅读(120) 评论(0) 推荐(0)