摘要:
一次过,超简单 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * Tre... 阅读全文
摘要:
用dfs large超时,看了网上答案用stack,其实一开始也想到了,只是没预料到stack比dfs更优越 1 class Solution { 2 public: 3 struct node { 4 char c; 5 int index; 6 ... 阅读全文
摘要:
小失误,基本一次过 1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 // Start typing your C/C++ solution below 5 //... 阅读全文
摘要:
自己的large没过,找到的网上答案跟一开始的想法是一样的,不过被网上的一个string的substr用法给坑了。。string.substr(strposstart, length) 1 class Solution { 2 public: 3 string longestPalindro... 阅读全文
摘要:
想到map了,可惜没想到用erase来节省空间,看了网上答案 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { 4 // Start typing your C/C++ solution ... 阅读全文
摘要:
string.erase没掌握好,悲了个剧,2次过 1 class Solution { 2 public: 3 string longestCommonPrefix(vector &strs) { 4 // Start typing your C/C++ solution ... 阅读全文
摘要:
一些小问题, “”的输出我的是[], 但是答案却是[""], 比较难理解,3次过 1 class Solution { 2 public: 3 void dfs(vector &ret, string tmp, map refer, string digits, int beg) { 4 ... 阅读全文
摘要:
初始length的时候忘给了0了,2次过 1 class Solution { 2 public: 3 int lengthOfLastWord(const char *s) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
摘要:
没想出来,看了网上答案再改了改 1 class Solution { 2 public: 3 struct node { 4 int left; 5 int right; 6 }; 7 int largestRectangleArea(vect... 阅读全文
摘要:
第一次给每个值都算最远距离,结果large没过,第二次用了现在的方法稍微改了改,最后过了,少数次过吧 1 class Solution { 2 public: 3 int jump(int A[], int n) { 4 // Start typing your C/C++ ... 阅读全文