当前位置:网站首页>[untitled] leetcode 2321 Maximum score of concatenated array
[untitled] leetcode 2321 Maximum score of concatenated array
2022-07-02 14:53:00 【HumbleFool】
LeetCode 2321. The maximum score of a concatenated array 
The prefix and 、 Interval maximum
class Solution {
public:
int process(vector<int>& a, vector<int>& b)
{
int sum = 0;
for(auto& n : a) sum += n;
int dt = 0, t = 0;
for(int i = 0; i < a.size(); i ++)
{
t = max(t + b[i] - a[i], b[i] - a[i]);
dt = max(dt, t);
}
return sum + dt;
}
int maximumsSplicedArray(vector<int>& nums1, vector<int>& nums2) {
return max(process(nums1, nums2), process(nums2, nums1));
}
};
边栏推荐
- info [email protected] : The platform “win32“ is incompatible with this module.
- 字符串匹配问题
- Check password
- Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
- buuctf-pwn write-ups (7)
- Reuse and distribution
- Fundamentals of software testing
- Yolov6 training: various problems encountered in training your dataset
- jmeter脚本参数化
- 3、函数指针和指针函数
猜你喜欢

Fatal: unsafe repository is owned by someone else

Uniapp automated test learning

Error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.

Yyds dry goods inventory software encryption lock function

Simple verification code generator for 51 single chip microcomputer experiment

MQ tutorial | exchange (switch)

电脑怎么设置扬声器播放麦克风的声音

< schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv

【空间&单细胞组学】第1期:单细胞结合空间转录组研究PDAC肿瘤微环境

MQ教程 | Exchange(交换机)
随机推荐
Tmall product details interface (APP, H5 end)
Fabric. JS manual bold text iText
Fabric.js 橡皮擦的用法(包含恢复功能)
Threejs controller cube space basic controller + inertia control + flight control
Delete element (with transition animation)
Introduction to mathjax (web display of mathematical formulas, vector)
Stm32-dac Experiment & high frequency DAC output test
LeetCode - 搜索二维矩阵
tmall. product. schema. Get (product information acquisition schema acquisition), Taobao store upload commodity API interface, Taobao commodity publishing interface, Taobao commodity upload API interf
taobao.trade.get( 获取单笔交易的部分信息),淘宝店铺订单接口,淘宝oAuth2.0接口,淘宝R2接口代码对接分享
btrace-(字节码)动态跟踪工具
Tujia muniao meituan has a discount match in summer. Will it be fragrant if the threshold is low?
< schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv
Fatal: unsafe repository is owned by someone else
Makefile 分隔文件名与后缀
##51单片机实验之简易验证码发生器
Pychart connects to the remote server
C# richTextBox控制显示最大行数
taobao.logistics.dummy.send( 无需物流发货处理 )接口,淘宝店铺发货API接口,淘宝订单发货接口,淘宝r2接口,淘宝oAu2.0接口
为什么只会编程的程序员无法成为优秀的开发者?