“常用公式”在线计算,“设计手册”在线查询
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 支持支持 反对反对

共 1 个关于本帖的回复 最后回复于 2013-7-30 16:20

沙发
新来的 发表于 2013-7-30 16:20:41 | 只看该作者
研发埠培训中心
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to buy one share of the stock and sell one share of the stock,design an algorithm to find the best times to buy and sell.Good answer:Go through the array in order,keeping track of the lowest stock priceand the best deal you've seen so far.Whenever the current stock price minus thecurrent lowest stock price is better than the current best deal,update the best deal to this new value.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注我们

360网站安全检测平台