自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(4)
  • 收藏
  • 关注

原创 LC 402, 316 贪心遇上栈 相同套路的两道题

to be written...

2018-05-15 21:00:13 165

原创 LC 309. Best Time to Buy and Sell Stock with Cooldown 股票系列之四 状态机 动态规划DP

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one an...

2018-05-11 15:27:51 304

原创 Best Time to Buy and Sell Stock 买股票系列三连

Leetcode里的买卖股票系列非常有名。之前做过这个系列里面的三道,分别是:121 Best Time to Buy and Sell Stock其中第一道题的要求是只能交易一次,因此就是寻找数组内正向的最大差值,解法是维护一个min变量存储当前遇到的最低股价,维护一个max存储当前可能的最大利润(用当前股价减去min),一次顺序遍历数组最后返回max就ok了。代码:int maxProfit(...

2018-05-11 14:29:48 2250

原创 Contains Duplicate系列三连- set,map的应用

又做完了一个系列,感觉收获良多。一共三道题,第一道和第二道都是easy,第三道是medium,不过我感觉第三道更接近hard。217. Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any val...

2018-05-01 16:01:20 139

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除