Leetcode
ZoeGreenn
Stay hungry.Stay foolish.
展开
-
2. Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linke原创 2016-04-28 20:29:11 · 331 阅读 · 0 评论 -
3.Longest Substring Without Repeating Characters
由于不能出现重复的,所以用map记录字符值和它出现的位置,就可以很容易判断出字符上次出现的位置。int lengthOfLongestSubstring(string s){ map<char,int> m; int lastRepeated=-1,max_length=0; for(int i=0;i<s.size();i++){ //如果该字符是重复的,则更新它最后一次出现的原创 2016-06-10 00:33:55 · 262 阅读 · 0 评论 -
5. Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 原题这题开始想用递归,没写出来,看了题解,原来可以原创 2016-06-15 23:13:15 · 323 阅读 · 0 评论