当前位置:网站首页>【无标题】LeetCode 2321. 拼接数组的最大分数
【无标题】LeetCode 2321. 拼接数组的最大分数
2022-07-02 11:26:00 【HumbleFool】
LeetCode 2321. 拼接数组的最大分数
前缀和、区间最大值
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));
}
};
边栏推荐
- 实现一个多进程并发的服务器
- Simple verification code generator for 51 single chip microcomputer experiment
- Fundamentals of software testing
- socket(套接字)与socket地址
- NLA自然语言分析实现数据分析零门槛
- Threejs controller cube space basic controller + inertia control + flight control
- Available solution development oral arithmetic training machine / math treasure / children's oral arithmetic treasure / intelligent math treasure LCD LCD driver ic-vk1622 (lqfp64 package), original te
- STM32-DAC实验&高频DAC输出测试
- 卷积神经网络(入门)
- Makefile 分隔文件名与后缀
猜你喜欢

由粒子加速器产生的反中子形成的白洞

报错:npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

Fabric.js 橡皮擦的用法(包含恢复功能)

MathML to latex

mathML转latex

一张图彻底掌握prototype、__proto__、constructor之前的关系(JS原型、原型链)

Yolov3 & yolov5 output result description

Pychart connects to the remote server

Yyds dry goods inventory software encryption lock function

天猫商品详情接口(APP,H5端)
随机推荐
Delete element (with transition animation)
Basic knowledge of QT original code
Li Chuang EDA learning notes 15: draw border or import border (DXF file)
Makefile separates file names and suffixes
Ad20 cannot select the solution of component packaging in PCB editor
[apipost] tutorial
Contrôleur pour threejs cube Space Basic Controller + Inertial Control + Flight Control
threejs的控制器 立方體空間 基本控制器+慣性控制+飛行控制
Makefile 分隔文件名与后缀
[QNX hypervisor 2.2 user manual]6.3 communication between guest and external
3、函数指针和指针函数
threejs的控制器 立方体空间 基本控制器+惯性控制+飞行控制
Advanced usage of C language -- function pointer: callback function; Conversion table
taobao.logistics.dummy.send( 无需物流发货处理 )接口,淘宝店铺发货API接口,淘宝订单发货接口,淘宝r2接口,淘宝oAu2.0接口
STM32库函数进行GPIO初始化
NLA natural language analysis realizes zero threshold of data analysis
卷积神经网络(入门)
3. Function pointers and pointer functions
mathML转latex
Full of knowledge points, how to use JMeter to generate encrypted data and write it to the database? Don't collect it quickly