当前位置:网站首页>leetcode 53. Maximum subarray maximum subarray sum (medium)
leetcode 53. Maximum subarray maximum subarray sum (medium)
2022-07-07 04:21:00 【InfoQ】
One 、 The main idea of the topic
- 1 <= nums.length <= 105
- -104 <= nums[i] <= 104
Two 、 Their thinking
3、 ... and 、 How to solve the problem
3.1 Java Realization
public class Solution {
public int maxSubArray(int[] nums) {
int n = nums.length;
int[] dp = new int[n];
dp[0] = nums[0];
int max = dp[0];
for (int i = 1; i < n; i++) {
dp[i] = Math.max(dp[i - 1] + nums[i], nums[i]);
max = Math.max(dp[i], max);
}
return max;
}
}
Four 、 Summary notes
- 2022/7/6 Do programmers also have “ scholars scorn each other ” What's wrong with
边栏推荐
- [written to the person who first published the paper] common problems in writing comprehensive scientific and Technological Papers
- EasyCVR视频广场点击播放时,主菜单高亮效果消失问题的修复
- pyqt5 失焦 监听无操作 定时器
- Golang compresses and decompresses zip files
- 【OA】Excel 文档生成器: Openpyxl 模块
- 接口自动化测试实践指导(中):接口测试场景有哪些
- NFT meta universe chain diversified ecosystem development case
- Allow public connections to local Ruby on Rails Development Server
- 1.19.11.SQL客户端、启动SQL客户端、执行SQL查询、环境配置文件、重启策略、自定义函数(User-defined Functions)、构造函数参数
- EasyUI export excel cannot download the method that the box pops up
猜你喜欢
Web service performance monitoring scheme
[on automation experience] the growth path of automated testing
接口自动化测试实践指导(中):接口测试场景有哪些
ABAP dynamic inner table grouping cycle
Optimization of channel status offline of other server devices caused by easycvr cluster restart
See Gardenia minor
Continuous learning of Robotics (Automation) - 2022-
[team learning] [34 sessions] Alibaba cloud Tianchi online programming training camp
机器人(自动化)课程的持续学习-2022-
视频融合云平台EasyCVR视频广场左侧栏列表样式优化
随机推荐
Five years of automated testing, and finally into the ByteDance, the annual salary of 30W is not out of reach
[ArcGIS tutorial] thematic map production - population density distribution map - population density analysis
DAB-DETR: DYNAMIC ANCHOR BOXES ARE BETTER QUERIES FOR DETR翻译
接口自动化测试实践指导(中):接口测试场景有哪些
Food Chem | in depth learning accurately predicts food categories and nutritional components based on ingredient statements
[team learning] [phase 34] Baidu PaddlePaddle AI talent Creation Camp
How do test / development programmers get promoted? From nothing, from thin to thick
The first introduction of the most complete mongodb in history
2022中青杯C题城市交通思路分析
【OA】Excel 文档生成器: Openpyxl 模块
什么是 CGI,什么是 IIS,什么是VPS「建议收藏」
【系统管理】清理任务栏的已删除程序的图标缓存
One of oscp tools: dirsearch usage Encyclopedia
leetcode 53. Maximum Subarray 最大子数组和(中等)
史上最全MongoDB之初识篇
Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
How to write a resume that shines in front of another interviewer [easy to understand]
Different meat customers joined hands with Dexter to launch different hamburgers in some stores across the country
Antd Comment 递归循环评论
如何编写一个程序猿另一个面试官眼前一亮的简历[通俗易懂]