LeetCode --- 15. 3Sum Jan 25, 2015

 Tags LeetCode , C++ , 数组 , 双指针

题目链接:3SumGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Not... More »

0条评论

LeetCode --- 14. Longest Common Prefix Jan 24, 2015

 Tags LeetCode , C++ , 字符串

题目链接:Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.这道题的要求是在字符串数组中找到最长公共前缀。思路比较简单,就是两个字符串逐个比较,找最长公共子串。这里采用将... More »

0条评论

LeetCode --- 13. Roman to Integer Jan 24, 2015

 Tags LeetCode , C++ , 数学 , 字符串

题目链接:Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.这道题的要求是将罗马数字转化成整数,其中输入数据范围是1到3999。罗马数字是最... More »

0条评论

LeetCode --- 12. Integer to Roman Jan 24, 2015

 Tags LeetCode , C++ , 数学 , 字符串

题目链接:Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.这道题的要求是将整数转化成罗马数字,其中输入数据范围是1到3999。罗马数字是最... More »

0条评论

LeetCode --- 11. Container With Most Water Jan 23, 2015

 Tags LeetCode , C++ , 数组 , 双指针

题目链接:Container With Most WaterGiven n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that th... More »

0条评论

LeetCode --- 10. Regular Expression Matching Jan 23, 2015

 Tags LeetCode , C++ , 动态规划 , 回溯 , 字符串

题目链接:Regular Expression MatchingImplement regular expression matching with support for ‘.’ and ‘*’.'.' Matches any single character. '*' Matches zero or more of the pr... More »

0条评论

LeetCode --- 9. Palindrome Number Jan 22, 2015

 Tags LeetCode , C++ , 数学

题目链接:Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are t... More »

0条评论

LeetCode --- 8. String to Integer (atoi) Jan 22, 2015

 Tags LeetCode , C++ , 数学 , 字符串

题目链接:String to Integer (atoi)Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not... More »

0条评论

LeetCode --- 7. Reverse Integer Jan 22, 2015

 Tags LeetCode , C++ , 数学

题目链接:Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some good questions t... More »

0条评论

LeetCode --- 6. ZigZag Conversion Jan 22, 2015

 Tags LeetCode , C++ , 字符串

题目链接:ZigZag ConversionThe 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 ... More »

0条评论