当前位置:网站首页>Sword finger offer II 012 The sum of left and right subarrays is equal
Sword finger offer II 012 The sum of left and right subarrays is equal
2022-06-25 17:04:00 【Python ml】
The finger of the sword Offer II 012. The sum of the left and right subarrays is equal
class Solution {
public:
int pivotIndex(vector<int>& nums) {
int total=accumulate(nums.begin(),nums.end(),0);
int sum=0;
for(int i=0;i<nums.size();++i){
if(2*sum+nums[i]==total)
return i;
sum+=nums[i];
}
return -1;
}
};
边栏推荐
- Ten thousand volumes - list of Dali wa
- tasklet api使用
- 剑指 Offer II 010. 和为 k 的子数组 前缀和差
- 剑指 Offer II 014. 字符串中的变位词 滑动窗口
- How did I get a salary increase of 13k+ after one year of employment?
- Day_ 18 hash table, generic
- MySQL 用 limit 为什么会影响性能?
- WPF开发随笔收录-心电图曲线绘制
- pychrm的这些配置,你都知道吗?
- Will the 2022 cloud world be better
猜你喜欢

Kalman filter meets deep learning: papers on Kalman filter and deep learning

Involution? Foam? Change? Ten questions directly hit the core puzzle of "meta universe" – the essence of "ask ta- Wang Lei about the time of the universe"

PLSQL 存储函数SQL编程

Redis系列——概述day1-1

剑指 Offer 39. 数组中出现次数超过一半的数字

SnakeYAML配置文件解析器

1-8Vmware中的文件共享

Kalman time series prediction

从业一年,我是如何涨薪13K+?

The art of code annotation. Does excellent code really need no annotation?
随机推荐
Ad domain login authentication
Simple dialogue system -- implement transformer by yourself
剑指 Offer II 035. 最小时间差
Uniapp to preview pictures (single / multiple)
批量--07---断点重提
"Podcast with relish" 386 Yuan Tang Hua Yuan Shi: who is not a "Mr. White character"?
How smart PLC constructs ALT instruction
浅谈 Web 3.0
論文筆記:LBCF: A Large-Scale Budget-Constrained Causal Forest Algorithm
SMART PLC如何构造ALT指令
【機器學習】基於多元時間序列對高考預測分析案例
Mac PHP multi version management and swoole extension installation
mood
Effects and laws
卡尔曼时间序列预测
Involution? Foam? Change? Ten questions directly hit the core puzzle of "meta universe" – the essence of "ask ta- Wang Lei about the time of the universe"
内卷?泡沫?变革?十个问题直击“元宇宙”核心困惑丨《问Ta-王雷元宇宙时间》精华实录...
Home office earned me C | community essay
How do components communicate
A TDD example