上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 38 下一页
摘要: 题目: 解答: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : 阅读全文
posted @ 2020-05-09 15:39 梦醒潇湘 阅读(111) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : 阅读全文
posted @ 2020-05-09 15:36 梦醒潇湘 阅读(149) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 bool validateStackSequences(vector<int>& pushed, vector<int>& popped) 4 { 5 stack<int> st; 6 int n = popped.siz 阅读全文
posted @ 2020-05-09 15:30 梦醒潇湘 阅读(145) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class MinStack { 2 stack<int> s; 3 stack<int> s2; 4 public: 5 /** initialize your data structure here. */ 6 MinStack() { 7 8 } 9 10 void pus 阅读全文
posted @ 2020-05-09 15:13 梦醒潇湘 阅读(129) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 vector<int> spiralOrder(vector<vector<int>>& matrix) 4 { 5 vector<int> result; 6 if (matrix.empty()) 7 { 8 retu 阅读全文
posted @ 2020-05-09 15:02 梦醒潇湘 阅读(138) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : 阅读全文
posted @ 2020-05-09 14:56 梦醒潇湘 阅读(179) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : 阅读全文
posted @ 2020-05-09 14:52 梦醒潇湘 阅读(159) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 1 class Solution { 2 2 bool isSubtree(TreeNode* pRootA, TreeNode* pRootB) 3 3 { 4 4 if (pRootB == NULL) 5 5 { 6 6 return true; 7 7 } 8 8 if 阅读全文
posted @ 2020-05-09 14:49 梦醒潇湘 阅读(136) 评论(0) 推荐(0)
摘要: 题目: 解答: 方法一:递归。 1 /* 2 struct ListNode { 3 int val; 4 struct ListNode *next; 5 ListNode(int x) : 6 val(x), next(NULL) { 7 } 8 };*/ 9 class Solution { 阅读全文
posted @ 2020-05-09 14:32 梦醒潇湘 阅读(119) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) { 阅读全文
posted @ 2020-05-09 14:25 梦醒潇湘 阅读(103) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 38 下一页