问题描述1:
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.
直接递归解决非递归方式可以参考上文的遍历方式得出。
问题描述2:
整数翻转,例如输入:123,输出:321;
题目下面的思考挺不错的
思考1:
10100翻转后如何输出?
思考2:
翻转后溢出如何处理?当不能抛出异常时如何处理?
思考1其实是很常见的转换后精度丢失的问题,当我们舍弃开头的0时,再次转换就不会得到和原来相同的结果,如果不舍弃的话又无法用整型输出,我得到的结论是用字符串来存储转换后的数字,同时在输出时从第一个非0数开始输出。
如果是思考2的话