当前位置:网站首页>Greedy interval problem (4)
Greedy interval problem (4)
2022-06-22 22:40:00 【Douglas_ LT】
A daily topic ing, Today is a day medium topic 122. Best Time to Buy and Sell Stock II
class Solution {
public:
int maxProfit(vector<int>& prices) {
int i = 0, profit = 0;
int n=prices.size();
for(int i=1;i<n;i++)
{
profit=profit+max(0,prices[i]-prices[i-1]);
}
return profit;
}
};
边栏推荐
- Core and semiconductor "RF eda/ filter design platform" shines ims2022
- Query es page subscript exceeds 10000
- VS代码一键整理快捷键
- 322. change exchange
- leetcode. 11 --- container with the most water
- 【李沐】 如何读论文【论文精读】
- Some shaders in AB package do not trigger the callback of ipreprocessshaders
- In the third week of June, the main growth ranking list (BiliBili platform) of station B single feigua data up was released!
- Generate detailed API and parameters of QR code using qrcodejs2
- What if the SQL execution plan of the production system suddenly becomes worse?
猜你喜欢

二级造价工程师考前必备15个知识点来了!祝你旗开得胜!

The required reading for candidates | PMP the test on June 25 is approaching. What should we pay attention to?

Reinforcement learning weekly (issue 50): saferl kit, gmi-drl, rp-sdrl & offline meta reinforcement learning

Système de bibliothèque libre - service - cas de conception complète de l'interface tkinter et du formulaire openpyxl

SPA项目开发之登录注册

Redis error reporting and common configurations

What are the methods of software stress testing and how to select a software stress testing organization?

SPA项目开发之CRUD+表单验证

Eureka服务注册与发现

Dynamic tree + data table + pagination of spa project development
随机推荐
How to use the data dictionary function in the low code platform of the Internet of things?
Wechat applet batch submission for review
A case of 94 SQL optimization (the writing method used is often rejected)
Atcoder abc256 full problem solution (interval merging template, matrix fast power optimization DP, line segment tree...)
大不列颠泰迪熊加入PUBG 手游
5分钟快速上线Web应用和API(Vercel)
Talk about SQL profile again: can I fix the execution plan?
pycharm 配置远程连接服务器开发环境
Some shaders in AB package do not trigger the callback of ipreprocessshaders
PMP Exam admission ticket problems and precautions in June, which must be read by candidates
MySQL multi table operation exercise
Pycharm configuring remote connection server development environment
[recommended by Zhihu knowledge master] castle in UAV - focusing on the application of UAV in different technical fields
Makefile:1860: recipe for target ‘cmake_check_build_system‘ failed make: *** [cmake_check_build_syst
Lua -- iterator, module, meta table
≥ server2012r2 system, disable some planned tasks of the system
【论文解读】关于基于视觉无人机自主降落平台的论文梳理
Half optimized SQL
Mysql database DQL exercise
CSV add a new column