摘要:
早早投降了,看了这个强大的代码 1 class Solution { 2 public: 3 double pow(double x, int n) { 4 // Start typing your C/C++ solution below 5 // DO N... 阅读全文
摘要:
这题关键是要记录下一层第一个节点 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * TreeLinkNode *left, *right, ... 阅读全文
摘要:
思路对的,少数次过,基本一次过吧 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * TreeLinkNode *left, *right, *next; 6 * TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {} 7 * }; 8 */ 9 class Solution {10 public:11 void connect(TreeLi... 阅读全文
摘要:
考vector的insert操作,一次过 1 class Solution { 2 public: 3 vector plusOne(vector &digits) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
摘要:
一些小失误,基本一次过,这题可以明显看到自己的进步,map用得比较成熟了 1 class Solution { 2 public: 3 void dfs(int dep, int maxdep, map &s, vector> &ret, vector &tmp) { 4 i... 阅读全文
摘要:
一次过 1 class Solution { 2 public: 3 void dfs(int dep, int maxdep, vector &tmp, vector> &ret, vector num, vector &visit) { 4 if (dep == maxd... 阅读全文
摘要:
这题的难度在编程,一开始想到的dfs过不了large,第二次想到网上的正确答案的思路,不过没有编出来,然后只好找答案了 1 class Solution { 2 public: 3 string getPermutation(int n, int k) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 string ret = ""; 7 int time = 1; 8 for (int... 阅读全文
摘要:
多数次过 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNo... 阅读全文
摘要:
少数次过 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNo... 阅读全文
摘要:
小失误,基本一次过 1 class Solution { 2 public: 3 vector getRow(int rowIndex) { 4 // Start typing your C/C++ solution below 5 // DO NOT wri... 阅读全文
摘要:
一点小失误,少数次过 1 class Solution { 2 public: 3 vector > generate(int numRows) { 4 // Start typing your C/C++ solution below 5 // DO NOT... 阅读全文
摘要:
一次过,链表题无难度 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : ... 阅读全文
摘要:
dfs large没过,看了网上的dp 1 class Solution { 2 public: 3 int minCut(string s) { 4 int n = s.size(); 5 vector C(n+1); 6 vector > ... 阅读全文
摘要:
一次过 1 class Solution { 2 public: 3 bool check(string s) { 4 for (int i = 0; i > &ret, vector &retin, string s, int beg, int size) {10 ... 阅读全文
摘要:
一点小失误,基本一次过吧 1 class Solution { 2 public: 3 bool isPalindrome(int x) { 4 // Start typing your C/C++ solution below 5 // DO NOT wri... 阅读全文