摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.思路:这道题就是让自己能得到最大的利润,举个例子{6,1,3,2,4,7},元素1和元素3得到利润为2,先保存起来,然 阅读全文
posted @ 2014-03-17 22:38 Awy 阅读(170) 评论(0) 推荐(0) 编辑
摘要: The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number... 阅读全文
posted @ 2014-03-17 22:05 Awy 阅读(198) 评论(0) 推荐(0) 编辑