摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo... 阅读全文
posted @ 2014-10-16 21:56 Avril 阅读(265) 评论(0) 推荐(0) 编辑
摘要:There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following req... 阅读全文
posted @ 2014-10-16 21:15 Avril 阅读(252) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.这题和sort list等题都比较相似,需要先用快慢指针的方法找到链表的中点,然后... 阅读全文
posted @ 2014-10-16 20:52 Avril 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2014-10-16 20:14 Avril 阅读(206) 评论(0) 推荐(0) 编辑