上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 43 下一页

2015年10月14日

121. Best Time to Buy and Sell Stock (Array;DP)

摘要: 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 阅读全文

posted @ 2015-10-14 18:38 joannae 阅读(184) 评论(0) 推荐(0) 编辑

2015年10月13日

38. Count and Say (String; DP)

摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文

posted @ 2015-10-13 19:26 joannae 阅读(201) 评论(0) 推荐(0) 编辑

2015年10月12日

60. Permutation Sequence (String; Math)

摘要: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence 阅读全文

posted @ 2015-10-12 06:29 joannae 阅读(192) 评论(0) 推荐(0) 编辑

2015年10月10日

内存中的堆栈

摘要: 函数调用入栈顺序在函数调用时,第一个进栈的是主函数中函数调用后的下一条指令的地址,然后是函数的各个参数。再然后是函数中的局部变量。注意静态变量是不入栈的。Pascal语言中函数参数从左到右入栈的,C语言则从右至左。原因是Pascal语言不支持可变长参数,而C语言支持这种特色。通过栈堆分析可知,自左向... 阅读全文

posted @ 2015-10-10 09:26 joannae 阅读(1307) 评论(0) 推荐(0) 编辑

2015年10月9日

42. Trapping Rain Water (Array,stack; DP)

摘要: 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 @ 2015-10-09 12:02 joannae 阅读(233) 评论(0) 推荐(0) 编辑

2015年10月8日

84. Largest Rectangle in Histogram (Array, Stack; DP)

摘要: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist 阅读全文

posted @ 2015-10-08 20:16 joannae 阅读(191) 评论(0) 推荐(0) 编辑

85. Maximal Rectangle (Graph; Stack, DP)

摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.思路:例如0110111010011101111011111000... 阅读全文

posted @ 2015-10-08 16:15 joannae 阅读(244) 评论(0) 推荐(0) 编辑

134. Gas Station (Array; DP)

摘要: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文

posted @ 2015-10-08 15:49 joannae 阅读(165) 评论(0) 推荐(0) 编辑

2015年10月6日

53. Maximum Subarray (Array; DP)

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2, 阅读全文

posted @ 2015-10-06 15:57 joannae 阅读(183) 评论(0) 推荐(0) 编辑

36. Valid Sudoku (Array; HashTable)

摘要: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled wit 阅读全文

posted @ 2015-10-06 13:29 joannae 阅读(220) 评论(0) 推荐(0) 编辑

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 43 下一页

导航