Source codes (Java) for leetcode
[DOC]
#Description
Report to solved/unsolved algortithm problems on leetcode.com. Can Also check my blog to see the tricks or pisfall while solving those problems. Do not forget to categorize qustions by their types and chosen algorithms, moreover, analyze its solution, time complexity, approach(iteration/recursion), corner problem, etc.
#Records
-
2020/10/11
- 思路
- 假設 a[i] 為 buy, 則 max{i+1,n} 為 sell 使得 profit 最大
- 注意
- 根据题目的意思,当天卖出以后,当天还可以买入,所以其实可以第三天卖出,第三天买入,第四天又卖出((5-1)+ (6-5) === 6 - 1)。所以算法可以直接简化为只要今天比昨天大,就卖出。
-
2015/11/04
- memo
-
2015/08/11
-
2015/07/30
142 Linked List Cycle II. reference
-
2015/03/23
- memo
-
2015/03/15
- memo
#Comment
- 2015/03/15 From StackOverFlow, it seems not to explicitly initialize the value to announced object, except local variable.