2015年4月19日
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo... 阅读全文
posted @ 2015-04-19 21:21 黄瓜小肥皂 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.采用二分递归。 1 class Solution { 2 public: 3 TreeNode *... 阅读全文
posted @ 2015-04-19 20:29 黄瓜小肥皂 阅读(128) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cli... 阅读全文
posted @ 2015-04-19 19:02 黄瓜小肥皂 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, ... 阅读全文
posted @ 2015-04-19 18:57 黄瓜小肥皂 阅读(124) 评论(0) 推荐(0) 编辑