摘要:
```C++ class Solution { public: void Mirror(TreeNode *pRoot) { if(pRoot == nullptr) return; cout val left; pRoot->left = pRoot->right; pRoot->right = temp; ... 阅读全文
posted @ 2018-08-25 23:19
一条图图犬
阅读(114)
评论(0)
推荐(0)
摘要:
参考:https://www.cnblogs.com/xudong bupt/p/3509567.html 尽量使用const以增加程序的鲁棒性 修饰函数体的时候: 可以使成员函数无法修改成员变量。 阅读全文
posted @ 2018-08-25 22:06
一条图图犬
阅读(134)
评论(0)
推荐(0)
摘要:
```C++
class Solution {
public: bool isSame(TreeNode* a, TreeNode* b) { if (a != nullptr && b != nullptr) { if (a->val == b->val) { return isSame(a->left, b->le... 阅读全文
posted @ 2018-08-25 21:20
一条图图犬
阅读(81)
评论(0)
推荐(0)
摘要:
```C++ class Solution { public: ListNode* Merge(ListNode* pHead1, ListNode* pHead2) { if(pHead1 == nullptr) return pHead2; if(pHead2 == nullptr) return pHead1; ListNode... 阅读全文
posted @ 2018-08-25 19:48
一条图图犬
阅读(83)
评论(0)
推荐(0)
摘要:
```C++
class Solution {
public: ListNode* ReverseList(ListNode* pHead) { ListNode* prev = nullptr; ListNode* curr = pHead; while ( curr != nullptr ){ curr = pHe... 阅读全文
posted @ 2018-08-25 19:05
一条图图犬
阅读(80)
评论(0)
推荐(0)
摘要:
```C++ class Solution { public: ListNode* FindKthToTail(ListNode* pListHead, unsigned int k) { if(pListHead == nullptr) return nullptr; int len = 0; ListNode* root = pListH... 阅读全文
posted @ 2018-08-25 18:44
一条图图犬
阅读(95)
评论(0)
推荐(0)
摘要:
```C++ class Solution { public: void reOrderArray(vector &array) { if(array.empty() || array.size() == 1){ return; } auto end = (int)array.size(); int 阅读全文
posted @ 2018-08-25 18:37
一条图图犬
阅读(122)
评论(0)
推荐(0)