Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Kadane's Algorithm
class Solution { public: int maxSubArray(vector<int>& nums) { int overall_max=nums[0]; int curr_max=nums[0]; for(int i=1;i<nums.size();i++) { curr_max=curr_max+nums[i]; if(curr_max<nums[i]) { curr_max=nums[i]; } overall_max=max(overall_max,curr_max); } return overall_max; } };
run
|
edit
|
history
|
help
0
Yo que se
PointPattern
Biggest even palindrom
basic caculate ii
Search in a rotated sorted array
diamond
TemplateDoubly
Tray
weak_ptr and Circle_reference
c++ car racing game