当前位置:网站首页>[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));
}
};
边栏推荐
- < 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
- Full of knowledge points, how to use JMeter to generate encrypted data and write it to the database? Don't collect it quickly
- Xilinx Vivado set *.svh as SystemVerilog Header
- Method of creating linked server for cross server data access
- mathjax 入门(web显示数学公式,矢量的)
- Quick analysis: easy to share the Internet
- threejs的控制器 立方体空间 基本控制器+惯性控制+飞行控制
- The use of TestNG, the testing framework (II): the use of TestNG XML
- 3. Function pointers and pointer functions
- Makefile 分隔文件名与后缀
猜你喜欢

MFC 定时器使用

socket(套接字)与socket地址

< 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

Quick analysis: easy to share the Internet

Fabric.js 上划线、中划线(删除线)、下划线

mathjax 入门(web显示数学公式,矢量的)

【apipost】使用教程

Makefile separates file names and suffixes

It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen

Method of creating linked server for cross server data access
随机推荐
Find the maximum inscribed circle of the contour
测试框架TestNG的使用(二):testNG xml的使用
buuctf-pwn write-ups (7)
Advanced usage of C language -- function pointer: callback function; Conversion table
2、const 型指针
Xilinx Vivado set *. svh as SystemVerilog Header
threejs的控制器 立方體空間 基本控制器+慣性控制+飛行控制
OpenCV调用USB摄像头的点滴
Onnx+tensorrt: write preprocessing operations to onnx and complete TRT deployment
taobao. trades. sold. Get query the transaction data that the seller has sold (according to the creation time), Taobao store sales order query API interface, Taobao R2 interface, Taobao oauth2.0 trans
富文本编辑器添加矢量公式(MathType for TinyMCE ,可视化添加)
LeetCode - 搜索二维矩阵
关于网页中的文本选择以及统计选中文本长度
Fabric.js 手动加粗文本iText
由粒子加速器产生的反中子形成的白洞
[development environment] StarUML tool (download software | StarUML installation | StarUML creation project)
STM32 library function for GPIO initialization
大顶堆、小顶堆与堆排序
1. Editing weapon VIM
Slashgear shares 2021 life changing technology products, which are somewhat unexpected