摘要:
```C++ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };
... 阅读全文
摘要:
```C++ class Solution { public: bool buddyStrings(string A, string B) { if(A.empty() || B.empty()){ return false; } if(A.size() != B.size()){ return f 阅读全文
摘要:
```C++ class Solution { public: int repeatedStringMatch(string A, string B) { string mA; int m=0; while(mA.size() 阅读全文
摘要:
```C++ class Solution { public: bool validPalindrome(string s) { int len = s.size(); if(len 阅读全文
摘要:
```C++
class Solution {
public: int lengthOfLastWord(string s) { auto p = (int)(s.size()-1); string res; while(p>=0 && s[p] == ' '){ p--; } whil... 阅读全文
摘要:
```C++ class Solution { public: string prefix2(string& str1, string& str2){ if(str1.empty() || str2.empty()){ return ""; } string res; auto sp1 = str1 阅读全文