首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
代码题:股票最大值。
[问答题]
代码题:股票最大值。
添加笔记
求解答(0)
邀请回答
收藏(7)
分享
纠错
1个回答
添加回答
0
LongXiaJun
leetcode 121:
def maxProfit(prices):
max_profit, min_price = 0, float('inf')
for price in prices:
min_price = min(price, min_price)
profit = price - min_price
max_profit = max(max_profit, profit)
return max_profit
发表于 2019-07-04 16:22:43
回复(0)
这道题你会答吗?花几分钟告诉大家答案吧!
提交观点
问题信息
上传者:
小小
难度:
1条回答
7收藏
607浏览
热门推荐
相关试题
对称二叉树
递归
枚举
评论
(1)
以下关于C++17 std::op...
C++
评论
(1)
以下代码使用ForkJoinPoo...
Java
评论
(1)
在Java并发编程中,以下哪些操作...
Java
评论
(1)
在设计模式中,以下哪些场景适合使用...
Java
评论
(1)
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题