摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2017-10-16 16:00 daniel456 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Given inorder and postorder traversal of a tree, construct the binary tree. 题目:给定一个树的中序排列和后续排列数组,重新绘制出该树 思路:由于后序的顺序的最后一个肯定是根,所以原二叉树的根节点可以知道,题目中给了一个很关键 阅读全文
posted @ 2017-10-16 15:44 daniel456 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 给定一个二叉树的先序遍历和 阅读全文
posted @ 2017-10-16 15:20 daniel456 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2017-10-16 11:19 daniel456 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example,If nums =  阅读全文
posted @ 2017-10-16 11:16 daniel456 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
posted @ 2017-10-16 11:03 daniel456 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
posted @ 2017-10-16 10:59 daniel456 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2017-10-16 10:52 daniel456 阅读(112) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2017-10-16 10:45 daniel456 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 题目:合并线段 阅读全文
posted @ 2017-10-16 10:39 daniel456 阅读(121) 评论(0) 推荐(0) 编辑