2016年5月23日

Jump Game II

摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文

posted @ 2016-05-23 21:03 Sheryl Wang 阅读(143) 评论(0) 推荐(0) 编辑

Jump Game

摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文

posted @ 2016-05-23 19:48 Sheryl Wang 阅读(177) 评论(0) 推荐(0) 编辑

2016年5月19日

Binary Search Tree Iterator

摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文

posted @ 2016-05-19 10:08 Sheryl Wang 阅读(217) 评论(0) 推荐(0) 编辑

2016年5月18日

Same Tree

摘要: 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-05-18 16:25 Sheryl Wang 阅读(164) 评论(0) 推荐(0) 编辑

2016年5月16日

Binary Tree Maximum Path Sum

摘要: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文

posted @ 2016-05-16 21:38 Sheryl Wang 阅读(188) 评论(0) 推荐(0) 编辑

2016年5月15日

Find Minimum in Rotated Sorted Array

摘要: 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-05-15 23:08 Sheryl Wang 阅读(112) 评论(0) 推荐(0) 编辑

Search in Rotated Sorted Array

摘要: 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). You are given a target va 阅读全文

posted @ 2016-05-15 23:07 Sheryl Wang 阅读(115) 评论(0) 推荐(0) 编辑

Binary Search 二分查找总结

摘要: Binary Search基本的复杂度为O(logn)。如果提示需要对O(n)的算法进行优化,非常可能就是二分,另外二分一般出现在排序数组或者变形后的排序数组(rotated array)当中。二分主要有两种,binary search on index(index上的二分)和binary sear 阅读全文

posted @ 2016-05-15 23:06 Sheryl Wang 阅读(286) 评论(0) 推荐(0) 编辑

Find Peak Element

摘要: 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 @ 2016-05-15 23:01 Sheryl Wang 阅读(189) 评论(0) 推荐(0) 编辑

Wood Cut

摘要: http://www.lintcode.com/zh-cn/problem/wood-cut/ 有一些原木,现在想把这些木头切割成一些长度相同的小段木头,需要得到的小段的数目至少为 k。当然,我们希望得到的小段越长越好,你需要计算能够得到的小段木头的最大长度。 注意事项 木头长度的单位是厘米。原木的 阅读全文

posted @ 2016-05-15 22:38 Sheryl Wang 阅读(393) 评论(0) 推荐(0) 编辑

导航