自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Pilgrim

希望某一天跪在那片向往的圣地,满含热泪,亲吻大地,将那之前所经历的种种痛苦,笑着说出来......

  • 博客(8)
  • 资源 (1)
  • 收藏
  • 关注

原创 ** Leetcode 188. Best Time to Buy and Sell Stock IV | dp

https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/感觉跟https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/description/这个有点像 DP方程 class Solution...

2018-04-30 21:32:03 148

原创 **Leetcode 28. Implement strStr() | KMP

https://leetcode.com/problems/implement-strstr/description/最近听说有面试遇到KMP的,赶紧补一下讲解看这里: 如何更好的理解和掌握 KMP 算法? - 海纳的回答 - 知乎https://www.zhihu.com/question/21923021/answer/281346746然后代码结合上面链接以及吉林大学模板吧void init...

2018-04-30 21:22:49 116

原创 **Leetcode 413. Arithmetic Slices

https://leetcode.com/problems/arithmetic-slices/description/非常好的dp题最初傻逼了 写的N^2的。。。然后就超内存了const int SZ = 5000+1;int dp[SZ][SZ];bool is[SZ][SZ];class Solution {public: int numberOfArithmeticSlic...

2018-04-11 03:24:01 158

原创 ***Leetcode 650. 2 Keys Keyboard

https://leetcode.com/problems/2-keys-keyboard/description/非常好的medium的题这里有个证明 https://leetcode.com/problems/2-keys-keyboard/discuss/105900/C++-O(sqrt(n))-DP-and-greedy-prime-number-solution里面a + b <...

2018-04-11 01:37:00 177

原创 *Leetcode 684. Redundant Connection | Union Find

https://leetcode.com/problems/redundant-connection/description/const int SZ = 1005;int parent[SZ];int find_parent(int x) { return x == parent[x] ? x : find_parent(parent[x]);}class Solution ...

2018-04-10 02:13:48 147

原创 *Leetcode 547. Friend Circles | Union Find

https://leetcode.com/problems/friend-circles/description/比较基本的题型了,注意一点,就是groups --, 在union的时候就行。 最初写的时候还遍历了一次求一共几个集合,太慢const int SZ = 205;int p[SZ];int pcnt[SZ];int find_p(int x) { return x ==...

2018-04-10 01:53:54 204

转载 nth_element()方法总结

转载自https://blog.csdn.net/xiaoquantouer/article/details/51591140一、函数参数nth_element(first, nth, last, compare)求[first, last]这个区间中第n大小的元素,如果参数加入了compare函数,就按compare函数的方式比较。二、头文件#include<algorithm>三、...

2018-04-03 11:41:32 5792

原创 **Leetcode 721. Accounts Merge

https://leetcode.com/problems/accounts-merge/description/并查集,,,没想到现在线上都开始考并查集了。。。参考了 https://leetcode.com/problems/accounts-merge/discuss/109157/JavaC++-Union-Findclass Solution {public: vector &...

2018-04-03 11:38:12 205

演示数据结构的算法过程

帮助数据结构学习,用flash动画生动的演示数据结构的算法过程

2014-01-29

空空如也

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

TA关注的人

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