摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文
posted @ 2017-10-16 16:26 daniel456 阅读(106) 评论(0) 推荐(0)
摘要: A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2017-10-16 16:13 daniel456 阅读(87) 评论(0) 推荐(0)
摘要: Suppose an array sorted in ascending order 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 阅读全文
posted @ 2017-10-16 16:10 daniel456 阅读(111) 评论(0) 推荐(0)
摘要: 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 阅读(126) 评论(0) 推荐(0)
摘要: Given inorder and postorder traversal of a tree, construct the binary tree. 题目:给定一个树的中序排列和后续排列数组,重新绘制出该树 思路:由于后序的顺序的最后一个肯定是根,所以原二叉树的根节点可以知道,题目中给了一个很关键 阅读全文
posted @ 2017-10-16 15:44 daniel456 阅读(182) 评论(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 阅读(162) 评论(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 阅读(158) 评论(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 阅读(153) 评论(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 阅读(121) 评论(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 阅读(127) 评论(0) 推荐(0)