当前位置:网站首页>121. The best time to buy and sell stocks
121. The best time to buy and sell stocks
2022-07-23 22:29:00 【Diga knock code】
class Solution {
public int maxProfit(int[] prices) {
int min = Integer.MAX_VALUE;
int max = 0;
for (int i = 0; i < prices.length; i++) {
if (prices[i] < min) {
min = prices[i];
}
if (prices[i] - min > max) {
max = prices[i] - min;
}
}
return max;
}
}
边栏推荐
- How to add an operator in ONEFLOW
- DeFi項目的盈利邏輯 2021-04-26
- Jedis 6 - Introduction and difference between redisson and jedis
- 详解NAT技术
- Yuanqi Digitalization: existing mode or open source innovation Lixia action
- U++ learning notes tsubclassof()
- Matlab wavelet toolbox import signal error (doesn't contain one dimensional single)
- [acwing] weekly competition
- Still worrying about xshell cracking, try tabby
- 【golang学习笔记】flag包的简单使用,命令行解析
猜你喜欢

Altium Designer - schematic diagram of Arduino uno & PCB diagram (self-made Arduino board)

Yuanqi Digitalization: existing mode or open source innovation Lixia action

MySQL index transaction

Rails搭配OSS最佳实践

Taobao assistant is disabled. What is the reason for using the big Taoying import data package to upload the baby prompt "the main image is required and cannot be empty"? How to solve it?

【golang学习笔记】Go语言中参数的传递是值传递还是引用传递

Leetcode high frequency question 53. maximum subarray sum, continuous subarray with maximum sum, return its maximum sum

What else do entrepreneurs need besides money? Exclusive interview with Mingyue Lake venture capital institutions
![[hiflow] Tencent cloud's new generation of automation assistant, which I used to complete the enterprise epidemic prompt (no code)](/img/8a/52ef97e43c4b06e08ab826f4e46501.png)
[hiflow] Tencent cloud's new generation of automation assistant, which I used to complete the enterprise epidemic prompt (no code)

How ZK solves the problem of cerebral fissure
随机推荐
[golang learning notes] simple use of flag package, command line parsing
【golang学习笔记】Go语言中参数的传递是值传递还是引用传递
DeFi项目的盈利逻辑 2021-04-26
小说里的编程 【连载之十九】元宇宙里月亮弯弯
MVVM和MVVMLight简介及项目开发(一)
大淘营批量采集商品,如何将未上传的宝贝保存下来等后面再导入采集上传
"Morning reading" if you were in my position, what would you do? How do we do it,
Basic character axis binding and mapping binding of u++ learning notes
University database creation and query practice -- database table design
Use of cjson Library
MySQL index transaction
STM32 MCU uses ADC function to drive finger heartbeat detection module
除了钱,创业者还需要什么?专访明月湖创赛创投机构
Neo4j application
Introduction and project development of MVVM and mvvmlight (I)
Still worrying about xshell cracking, try tabby
How to completely force the killing of background unrelated processes?
el-select下拉框多选远程搜索反显
Tiktok launches multilingual subtitles and translation tools
The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)