上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页
摘要: ```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 一条图图犬 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 参考:https://www.cnblogs.com/xudong bupt/p/3509567.html 尽量使用const以增加程序的鲁棒性 修饰函数体的时候: 可以使成员函数无法修改成员变量。 阅读全文
posted @ 2018-08-25 22:06 一条图图犬 阅读(124) 评论(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 一条图图犬 阅读(77) 评论(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 一条图图犬 阅读(76) 评论(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 一条图图犬 阅读(78) 评论(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 一条图图犬 阅读(88) 评论(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 一条图图犬 阅读(115) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: double Power(double base, int exponent) { double res = 1; if(exponent == 0){ if(base == 0){ return 1; } else{ return 1 阅读全文
posted @ 2018-08-23 19:09 一条图图犬 阅读(87) 评论(0) 推荐(0) 编辑
摘要: ```C++ int jumpFloorII(int number) { return pow(2, number-1); } ``` 阅读全文
posted @ 2018-08-23 18:39 一条图图犬 阅读(101) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: void push(int node) { stack1.push(node); } int pop() { if(stack1.empty() && stack2.empty()){ return -1; } if(!s... 阅读全文
posted @ 2018-08-21 20:07 一条图图犬 阅读(76) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页