![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode_376
delia0204
on the way
展开
-
STL --- understand
标准模板库转载 2016-04-12 20:25:09 · 319 阅读 · 0 评论 -
1.Two Sum
for example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. solution: 1.brute force Complexity Analysis Time complexity : O(n^2)O(n2原创 2016-07-23 18:01:08 · 172 阅读 · 0 评论 -
2.Add Two Numbers
for examples: Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 -> 8 #include using namespace std; class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { L原创 2016-07-23 21:46:42 · 349 阅读 · 0 评论 -
KMP再思考
KMP原创 2016-07-12 19:49:02 · 215 阅读 · 0 评论 -
堆排序
堆排序原创 2016-07-14 08:33:48 · 203 阅读 · 0 评论 -
3.Longest Substring Without Repeating Characters
for example: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of 1. Given "pwwkew", the answer is "wke", with the length原创 2016-07-25 15:54:42 · 418 阅读 · 0 评论 -
并查集理解
算法就应该这样来理解 转自:http://blog.csdn.net/dellaserss/article/details/7724401/ 并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?) 来看一个实例,杭电1232畅通工程转载 2016-07-09 12:13:58 · 282 阅读 · 0 评论 -
hiho_110week
question: 给定一张N个点的完全图,可以从任何一个点出发,同一个点可以经过多次。询问总路径长度不超过M的情况下,最多能够经过多少个点。【边长度都为1】 analyse: 一、常规解析 使用数据结构: dist[][],dist[i][j]表示经过i个点后,最后停留在j所以经过的最短路径长度;edge[j][k]表示从点j到点k的边长 dist[i][j] =原创 2016-08-10 20:09:29 · 233 阅读 · 0 评论 -
6. ZigZag Conversion
题目大意: 锯齿形排布的字符串 可以考虑在记录新字符串的时候也根据字符串的分布趋势来记录。 即每一次都是先记录纵向的再记录斜的,这里可以使用字符串数组来分行记录。 参考代码:(C++) class Solution { public: string convert(string s, int numRows) { string r原创 2016-08-13 22:09:19 · 191 阅读 · 0 评论