摘要: ```C++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; ... 阅读全文
posted @ 2018-07-27 23:22 一条图图犬 阅读(189) 评论(0) 推荐(0) 编辑
摘要: ```C++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; ... 阅读全文
posted @ 2018-07-27 23:06 一条图图犬 阅读(359) 评论(0) 推荐(0) 编辑
摘要: ```C++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; ... 阅读全文
posted @ 2018-07-27 22:45 一条图图犬 阅读(468) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: bool buddyStrings(string A, string B) { if(A.empty() || B.empty()){ return false; } if(A.size() != B.size()){ return f 阅读全文
posted @ 2018-07-27 16:17 一条图图犬 阅读(380) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: int repeatedStringMatch(string A, string B) { string mA; int m=0; while(mA.size() 阅读全文
posted @ 2018-07-27 15:40 一条图图犬 阅读(279) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: bool validPalindrome(string s) { int len = s.size(); if(len 阅读全文
posted @ 2018-07-27 13:31 一条图图犬 阅读(281) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: int lengthOfLastWord(string s) { auto p = (int)(s.size()-1); string res; while(p>=0 && s[p] == ' '){ p--; } whil... 阅读全文
posted @ 2018-07-27 11:38 一条图图犬 阅读(278) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: string prefix2(string& str1, string& str2){ if(str1.empty() || str2.empty()){ return ""; } string res; auto sp1 = str1 阅读全文
posted @ 2018-07-27 11:22 一条图图犬 阅读(619) 评论(0) 推荐(0) 编辑