当前位置:网站首页>[dynamic programming] leetcode 53: maximum subarray sum
[dynamic programming] leetcode 53: maximum subarray sum
2022-07-04 00:34:00 【muse_ age】


initialization : dp[0]=nums[0];
Code :
class Solution {
public:
int dp[100001];
int maxSubArray(vector<int>& nums) {
dp[0]=nums[0];
for(int i=1;i<nums.size();i++){
dp[i]=max(dp[i-1]+nums[i],nums[i]);
}
int res=dp[0];
for(int i=0;i<nums.size();i++)
res=max(dp[i],res);
return res;
}
};边栏推荐
- Development and application of fcitx functional plug-ins
- Introducing Software Testing
- The super fully automated test learning materials sorted out after a long talk with a Tencent eight year old test all night! (full of dry goods
- Similarities and differences of text similarity between Jaccard and cosine
- Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
- Social network analysis -social network analysis
- Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
- Severity code description the project file line prohibits the display of status error c4996 fopen ('fscanf ', StrCmp): this function or variable may be unsafe The most comprehensive solution
- Version rollback revert don't reset better reset must be forced
- Global and Chinese markets for coronary artery disease treatment devices 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders

Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools

(Introduction to database system | Wang Shan) Chapter V database integrity: Exercises
![[CSDN Q & A] experience and suggestions](/img/db/dff3173dda24ca5740729b54a81153.jpg)
[CSDN Q & A] experience and suggestions
![[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept](/img/b4/961b3b44e9ecbfd4bddd04318b663a.jpg)
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept

(Video + graphics and text) introduction to machine learning series - Chapter 4 naive Bayes

Axure resources and prototype tool Axure RP 9 download

NLP Chinese corpus project: large scale Chinese natural language processing corpus

Reading notes on how programs run

Makefile judge custom variables
随机推荐
不得不会的Oracle数据库知识点(二)
Analysis: misunderstanding of choosing WMS warehouse management system
Idea a method for starting multiple instances of a service
Data mining vs Machine Learning: what is the difference between them? Which is more suitable for you to learn
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
NLP Chinese corpus project: large scale Chinese natural language processing corpus
Global and Chinese market of breast cancer imaging 2022-2028: Research Report on technology, participants, trends, market size and share
Arc 135 supplementary report
Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at
Regular expressions and text processors for shell programming
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
The difference between fetchtype lazy and eagle in JPA
Sorry, Tencent I also refused
UTS | causal reasoning random intervention based on Reinforcement Learning
Software testers, how can you quickly improve your testing skills? Ten minutes to teach you
AI Challenger 2018 text mining competition related solutions and code summary
Reading notes on how programs run
SPI based on firmware library
Yyds dry goods inventory three JS source code interpretation - getobjectbyproperty method
[about text classification trick] things you don't know