上一页 1 2 3 4 5 6 ··· 12 下一页
摘要: 作为log(n) search 方法的典型, Binary Search基本可以分为以下几类 下面逐个解说: 1. 准确number, 这个比较简单,就是可以分为3中情况,mid等于,mid小于,mid大于。不赘述,具体code如下 几个典型的题为 2. 3. First Bad Version. 阅读全文
posted @ 2016-10-27 12:24 咖啡中不塌缩的方糖 阅读(352) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2016-10-27 07:51 咖啡中不塌缩的方糖 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. Hi 阅读全文
posted @ 2016-10-22 11:31 咖啡中不塌缩的方糖 阅读(121) 评论(0) 推荐(0) 编辑
摘要: The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou 阅读全文
posted @ 2016-10-22 11:02 咖啡中不塌缩的方糖 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Given a complete binary tree, count the number of nodes. http://www.programcreek.com/2014/06/leetcode-count-complete-tree-nodes-java/ 阅读全文
posted @ 2016-10-20 04:54 咖啡中不塌缩的方糖 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2016-10-18 10:33 咖啡中不塌缩的方糖 阅读(105) 评论(0) 推荐(0) 编辑
摘要: buy and sell stocks 在leetcode现在总共有5 道题。 Best Time to Buy and Sell Stock 这道题是基础,只能transaction一次,所以我们用 Best Time to Buy and Sell Stock II 这道题表示可以一直trans 阅读全文
posted @ 2016-09-27 12:56 咖啡中不塌缩的方糖 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Find the sum of all left leaves in a given binary tree. Example: Iteration: 阅读全文
posted @ 2016-09-27 03:26 咖啡中不塌缩的方糖 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD 阅读全文
posted @ 2016-09-27 03:02 咖啡中不塌缩的方糖 阅读(172) 评论(0) 推荐(0) 编辑
摘要: You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a conca 阅读全文
posted @ 2016-09-26 23:27 咖啡中不塌缩的方糖 阅读(127) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 12 下一页