当前位置:网站首页>121. 买卖股票的最佳时机
121. 买卖股票的最佳时机
2022-07-23 19:08:00 【迪迦敲代码】
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;
}
}
边栏推荐
- Typescript新数据类型Symbol的使用
- Leetcode 238. product of arrays other than itself
- Leetcode 216. 组合总和 III
- Adobe Acrobat two powerful plug-ins
- What antenna is used for ant interface_ There is an interface at the back of the TV that says standard ant 75 Euro input. What does it mean, antenna? Can you connect the closed route "Suggested collec
- 梅科尔工作室-华为14天鸿蒙设备开发实战笔记六
- Reduced order method of linear algebraic determinant calculation method
- 梅科尔工作室-小熊派开发笔记3
- BM14 链表的奇偶重排
- 【AR学习】-- 二、 环境搭建
猜你喜欢

编译器LLVM-MLIR-Intrinics-llvm backend-instruction

Introduction to web security SSH testing and defense

I deliberately leave a loophole in the code. Is it illegal?
![[ar learning] - II. Environment construction](/img/e8/c20de6a46ef70b6eb49684d685e4cd.png)
[ar learning] - II. Environment construction

Failure after reinstalling the system (error: Reboot and select proper boot device or insert boot media in selected boot device)

Leetcode 151. invert words in strings

The numerical sequence caused by the PostgreSQL sequence cache parameter is discontinuous with interval gap

PostgreSQL sequence cache 参数导致的数值序列不连续 有间隔 gap

Energy principle and variational method note 16: solution of virtual displacement principle

web安全入门-ssh测试与防御
随机推荐
17. Life cycle
osgearth2.8编译siverlining云效果
深入浅出边缘云 | 1. 概述
【AR学习】-- 二、 环境搭建
R language uses the gather function of tidyr package to convert a wide table to a long table (wide table to long table), the first parameter specifies the name of the new data column generated from th
梅科尔工作室-华为14天鸿蒙设备开发实战笔记四
Redux summation case explanation version tutorial
Typescript use of new data type symbol
能量原理与变分法笔记12:最小势能原理
Energy principle and variational method note 17: generalized variational principle (identification factor method)
2022 Shandong old age Expo, Shandong elderly care exhibition, China International elderly care service industry exhibition was held in September
How to add to-do items for win11 widgets? Win11 method of adding to-do widget
多子系统多业务模块的复杂数据处理——基于指令集物联网操作系统的项目开发实践
MySQL master-slave replication
Hongke dry goods | teaches you how to parse floating-point data in MODBUS
Osgearth2.8 compiling silvering cloud effect
[PM2] PM2 common commands
ant接口用什么天线_电视后面有个接口写的是 标准ANT 75 欧输入,请问是什么意思,是天线吗?可不可以接闭路线啊?…「建议收藏」
Dokcer image understanding
能量原理与变分法笔记17:广义变分原理(识别因子方法)