摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following is not: 1 / \ 2 2 \ \ 3 3 Note:Bonus points if you could solve it both recursively a... 阅读全文
posted @ 2012-12-24 23:32 西施豆腐渣 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.For example,Given input array A =[1,1,2],Your function should return length =2, and A is 阅读全文
posted @ 2012-12-24 07:47 西施豆腐渣 阅读(161) 评论(0) 推荐(0) 编辑
摘要: The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H N A P L S I I G Y I R And then read line by line:"PAHNAPLSIIGYIR"Write the code that will take a string 阅读全文
posted @ 2012-12-24 07:36 西施豆腐渣 阅读(130) 评论(0) 推荐(0) 编辑