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
References Pt 1 C++
Microsoft - # of fragments (optimised)
Using initializer_list<T>
2021, M2, Simulare;S3: 2
Segmented Sieve
СП КИ ЭТАП 2
Hashing
Cuantos
decode
Smalllest subarray wiith sum greater than x