摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Summary: pretty easy, recursive staff. 1 class Solution { 2 public: 3 TreeNode *sortedArrayToBST(vector &num) { 4 int size = num.size(); 5 if(size == 0) 6 return NULL; 7 ... 阅读全文
posted @ 2013-11-03 06:51 假日笛声 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have 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 阅读全文
posted @ 2013-11-03 06:11 假日笛声 阅读(149) 评论(0) 推荐(0) 编辑