当前位置:网站首页>LeetCode daily two 02: the best time to buy stocks (1200)
LeetCode daily two 02: the best time to buy stocks (1200)
2022-08-07 15:37:00 【The man was fishing for snow in the cold river alone.】

Problem solving ideas:
class Solution {public int maxProfit(int[] prices) {int total = 0;for (int i = 0; i <prices.length - 1; i++) {//If the latter minus the former is a positive number in the original array, it means it is rising, //We have to accumulate, otherwise we will not accumulatetotal += Math.max(prices[i + 1] - prices[i], 0);}return total;}}边栏推荐
- 微信小程序——swiper设置同时显示滑块数量
- 小技巧——postman get&&post请求的使用方式
- LeetCode HOT HOT 100 (9. Telephone number letter combinations)
- LeetCode刷题系列 -- 678. 有效的括号字符串
- LeetCode 热题 HOT 100(6.正则表达式匹配)
- JS——判断js对象是否存在某个属性
- MySQL-Advanced CRUD
- 【PTA】L2-033 Simple Calculator (25 points)
- sql,update偶发性报错,ERROR: invalid input syntax for integer: '0.00'?
- LeetCode 热题 HOT 100(5.最长回文子串)
猜你喜欢

LeetCode 热题 HOT 100(9.电话号码的字母组合)

第⼆⼗九章 新版SSM整合-打通Mysql数据库控制事务(包含⾯试题)

Chapter 8 C programming expert why programmers cannot distinguish where Halloween and Christmas 8.5 prototype fail

Chapter 219 New SSM Integration - Getting Through Mysql Database Control Transactions (including interview questions)

MySQL的UPDATE及SELECT...FOR UPDATE语句关于锁的一些简单验证
![[Principle of Database System] Chapter 3 BC Normal Form, Third Normal Form and Fourth Normal Form](/img/1a/e97745e62287fcf494d1479deaa632.png)
[Principle of Database System] Chapter 3 BC Normal Form, Third Normal Form and Fourth Normal Form

简记_Altium Designer 相同模块的布局布线复用

小技巧——postman配置token

RTT学习笔记8-RTT内核移植

06 【泛型】
随机推荐
IPV6的内容
冒泡排序的理解
win10 uwp ContentDialog 点确定不关闭
Browser working principle and practical study notes (1) Browser from a macro perspective
ETCD快速入门-01 ETCD概述
微信小程序——video视频全屏展示
打印从1到最大的n位数------2022/08/05
LeetCode HOT HOT 100 (9. Telephone number letter combinations)
LeetCode 热题 HOT 100(8.三数之和)
【通信原理】第四章 -- 信道
【Verilog】时序逻辑电路 -- 有限同步状态机[补充]
简单的网页制作期末作业——电影泰坦尼克号(4页)
【高等数学】高数整理:常见等价无穷小、导数和微分、微分方程
When make compile source code, error: 'for' loop initial declarations are only allowed in C99 mode solution
小技巧——postman配置token
php源码随机输出某个目录下的图片API
The use of function helpers in jmter
【数据库系统原理】第四章 高级数据库模型:E/R模型及其设计规则、约束
嵌入式设备参数存储技巧
Oracle常用数值型函数