- 博客(6)
- 收藏
- 关注
原创 leeticode 121.122.123. Best Time to Buy and Sell Stock
问题一Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of
2016-06-21 20:15:44
381
原创 leetcode 263.264.313 Ugly Number 丑数
第3题题目Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4
2016-06-16 20:23:15
403
原创 leetcode 198.213.337 House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house
2016-06-16 19:59:25
293
原创 leetcode 34. Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found
2016-06-13 19:49:14
225
原创 leetcode 216. Combination Sum III
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1:Inpu
2016-06-13 19:36:41
347
原创 leetcode 239. Sliding Window Maximum
提取每K个子数组中的最大值,难点在于O(n)时间复杂度完成。参考Discuss发现可以用一个deque维护目前字数组中较大的几个数值,然后取出.front()为最大值。注意deque存的是对应的下标而不是值。deque队头存的是最大值,每遍历下一个nums的元素,就将其和deque中下标对应的元素比较,从队尾开始,踢除小于目前下标元素的deque中所有元素。但记住,在此之前要先判断de
2016-06-13 19:14:57
294
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅