摘要:
题目Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?分析判断一个链表是否为回文。要求时间复杂度O(n...
阅读全文
posted @ 2015-12-03 13:30
Coding菌
阅读(140)
推荐(0)
摘要:
题目分析交换二叉树的左右子树。递归非递归两种方法实现。AC代码class Solution {public: //递归实现 TreeNode* invertTree(TreeNode* root) { if (!root) retur...
阅读全文
posted @ 2015-12-03 12:59
Coding菌
阅读(105)
推荐(0)
posted @ 2015-12-03 12:58
Coding菌
阅读(92)
推荐(0)
摘要:
题目Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice...
阅读全文
posted @ 2015-12-03 12:46
Coding菌
阅读(115)
推荐(0)