摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you have already thought through this!If the integer's last digit is 0, what should the output be? ie, cas 阅读全文
posted @ 2014-02-28 21:54 Awy 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 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 and the nodes have the same value.分析:注意边界条件的判断,先判断两树是不是为空,都为空,则为true,否则递归判断存在的其他情况,判断左右子树的情况。/** * Definition for binary tree * struct TreeNode { * ... 阅读全文
posted @ 2014-02-28 00:51 Awy 阅读(255) 评论(0) 推荐(0) 编辑