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
Subarray with 0 sum
Problem D
matrix calculator
thread
shifting
.
Temp
Sample Code from Scott Meyer's Blog
Reverese every K node in list
LRUCache