2015年4月20日

摘要: Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr... 阅读全文
posted @ 2015-04-20 17:35 lysuns 阅读(162) 评论(0) 推荐(0)
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl... 阅读全文
posted @ 2015-04-20 16:54 lysuns 阅读(204) 评论(0) 推荐(0)

2015年4月17日

摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo... 阅读全文
posted @ 2015-04-17 16:34 lysuns 阅读(162) 评论(0) 推荐(0)
摘要: Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.... 阅读全文
posted @ 2015-04-17 12:34 lysuns 阅读(504) 评论(0) 推荐(0)
摘要: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font ... 阅读全文
posted @ 2015-04-17 10:06 lysuns 阅读(204) 评论(0) 推荐(0)

2015年4月10日

摘要: 最长回文子串:1. 暴力搜索 时间复杂度O(n^3)2. 动态规划dp[i][j] 表示子串s[i…j]是否是回文初始化:dp[i][i] = true (0 i) ? min(p[j], mx-i) : 0; while (cstr[i + p[i] + 1] == cs... 阅读全文
posted @ 2015-04-10 17:17 lysuns 阅读(219) 评论(0) 推荐(0)
摘要: Problem 2 ---Add Two Numbers简单的模拟题。Problem 3 ---Longest Substring Without Repeating Characters题意: 给定一个字符串序列,找出最长无重复的子序列。如"abcabcbb"的最长不重复子序列为"abc"思路: ... 阅读全文
posted @ 2015-04-10 17:00 lysuns 阅读(182) 评论(0) 推荐(0)

2015年3月11日

摘要: 1.引言 C++语言的创建初衷是“a better C”,但是这并不意味着C++中类似C语言的全局变量和函数所采用的编译和连接方式与C语言完全相同。作为一种欲与C兼容的语言,C++保留了一部分过程 式语言的特点(被世人称为“不彻底地面向对象”),因而它可以定义不属于任何类的全局变量和函数。但是,C... 阅读全文
posted @ 2015-03-11 10:13 lysuns 阅读(217) 评论(0) 推荐(0)

2015年3月9日

摘要: unordered_map和map类似,都是存储的key-value的值,可以通过key快速索引到value。不同的是unordered_map不会根据key的大小进行排序,存储时是根据key的hash值判断元素是否相同,即unordered_map内部元素是无序的,而map中的元素是按照二叉搜索树... 阅读全文
posted @ 2015-03-09 21:13 lysuns 阅读(3115) 评论(0) 推荐(0)
摘要: 首先摆出Lambda表达式语法lambda-expression: lambda-introducer lambda-declaratoropt compound-statementlambda-introducer: [ lambda-captureopt ]lambda-capture: ... 阅读全文
posted @ 2015-03-09 20:53 lysuns 阅读(1021) 评论(0) 推荐(0)

导航