摘要:
Given a binary tree, return the postordertraversal of its nodes' values. Example: 非递归的方法,以下第一方法便于理解与记忆。第二个方法不便于记忆; 阅读全文
摘要:
Given a binary tree, return the inordertraversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively? 阅读全文
摘要:
Given a binary tree, return the preordertraversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively 阅读全文
摘要:
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- 阅读全文
摘要:
struct ListNode { int m_nKey; ListNode* next; } ListNode* reverseList(ListNode* pHead) { ListNode* pReversedHead = nullptr; ListNode* pNode = pHead; ListNode* pPrev = nullptr; while(pNode != nullptr){ 阅读全文