- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 leetcode 第13-14题 Roman to Integer & Longest Common Prefix
class Solution { public: string longestCommonPrefix(vector &strs) { string ans=""; int len=strs.size(); if(len==0)return ans; int count=strs[0].size
2014-04-30 10:24:49 505
原创 leetcode 第11-12题
string myf(int x,int num){ string ss="IVXLCDM"; string s=""; for(int i=0;i s+=ss[x]; return s; } class Solution { public: string intToRoman(int num) {
2014-04-28 09:38:22 832
原创 leetcode 第10题 Regular Expression Matching
该题主要考正则表达式,需要迭代的去匹配,自然想到用递归,先考虑结束bi
2014-04-25 12:34:29 885
原创 leetcode 第9题 Palindrome Number
class Solution { public: bool isPalindrome(int x) { if(x if(x>=0&&x long long k=0; long long y=x; cout while(x>0) {
2014-04-23 12:02:22 514
原创 leetcode 第5题 Longest Palindromic Substring
class Solution { public: string longestPalindrome(string s) { string res=""; if(s.size() int n=s.size(); for(int i=0;i string s1="",s2="";
2014-04-19 21:00:16 771
原创 leetcode 第4题 Add Two Numbers
ListNode *myfunction(ListNode *l1, ListNode *l2,int dis) { ListNode *p1=l1; ListNode *p2=l2; ListNode *p3=new ListNode(0); ListNode *p4=p3; int k=0; whi
2014-04-18 17:43:30 646
原创 leetcode 第三题 Longest Substring Without Repeating Characters
queueque; //通过记录不重复部分的数据,每次发现重复,就踢出重复元素(前一个)前面的数据 class Solution1 { public: int lengthOfLongestSubstring(string s) { int len = s.size(); int i = 0, j = 1; int res =
2014-04-18 17:21:49 624
原创 leetcode 第二题 median of two sorted arrays
这题刚看时,确实没有认真对待,后来细做下来,一直没有比较高效的想法
2014-04-18 17:12:56 662
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人