摘要: 问题: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return –321 Have you thought about this? Here are some good questions to ask before coding. Bonus p... 阅读全文
posted @ 2014-10-07 18:08 苍枫露雨 阅读(656) 评论(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. 分析: ... 阅读全文
posted @ 2014-10-07 15:39 苍枫露雨 阅读(459) 评论(0) 推荐(0) 编辑
摘要: 问题: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without us... 阅读全文
posted @ 2014-10-07 15:28 苍枫露雨 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 问题: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 分析: 二维数组a[n][n]顺时针旋转90度,要解决这个问题,无疑,第一件事儿就... 阅读全文
posted @ 2014-10-07 15:18 苍枫露雨 阅读(9083) 评论(1) 推荐(2) 编辑