摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2014-10-23 10:32 buptzjf 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thepreordertraversal of its nodes' values.问题: 前序遍历二叉树。分析: 前序遍历:若二叉树为空则结束返回,否则: (1)访问根结点。 (... 阅读全文
posted @ 2014-10-23 09:55 buptzjf 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2014-10-23 09:44 buptzjf 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearstwiceexcept for one. Find that single one.问题: 给一个整数数组,除了一个是单独出现的,其他都是成对出现的,把这一个单独出现的找出来。思路: 对于每个数循环... 阅读全文
posted @ 2014-10-23 09:21 buptzjf 阅读(120) 评论(0) 推荐(0) 编辑