学会思考
刻意练习
摘要: Given a binary tree, return the postordertraversal of its nodes' values. Example: 非递归的方法,以下第一方法便于理解与记忆。第二个方法不便于记忆; 阅读全文
posted @ 2019-08-27 22:20 Worty 阅读(175) 评论(0) 推荐(0)
摘要: Given a binary tree, return the inordertraversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively? 阅读全文
posted @ 2019-08-27 22:19 Worty 阅读(195) 评论(0) 推荐(0)
摘要: Given a binary tree, return the preordertraversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively 阅读全文
posted @ 2019-08-27 22:18 Worty 阅读(245) 评论(0) 推荐(0)
摘要: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3- 阅读全文
posted @ 2019-08-27 21:54 Worty 阅读(190) 评论(0) 推荐(0)
摘要: struct ListNode { int m_nKey; ListNode* next; } ListNode* reverseList(ListNode* pHead) { ListNode* pReversedHead = nullptr; ListNode* pNode = pHead; ListNode* pPrev = nullptr; while(pNode != nullptr){ 阅读全文
posted @ 2019-08-27 21:34 Worty 阅读(247) 评论(0) 推荐(0)