Comments (3)
#include <bits/stdc++.h>
using namespace std;
int maxSubArraySum(int a[], int size)
{
int max_so_far = INT_MIN, max_ending_here = 0;
for (int i = 0; i < size; i++) {
max_ending_here = max_ending_here + a[i];
if (max_so_far < max_ending_here)
max_so_far = max_ending_here;
if (max_ending_here < 0)
max_ending_here = 0;
}
return max_so_far;
}
// Driver Code
int main()
{
int a[] = { -2, -3, 4, -1, -2, 1, 5, -3 };
int n = sizeof(a) / sizeof(a[0]);
// Function Call
int max_sum = maxSubArraySum(a, n);
cout << "Maximum contiguous sum is " << max_sum;
return 0;
}
from hacktoberfest2022-for-everyone.
Closing this issue because code for kadane algorithm is already present in repository. Kindly check repository before opening any new issues. Thanks
from hacktoberfest2022-for-everyone.
from hacktoberfest2022-for-everyone.
Related Issues (20)
- Digital Clock GUI
- house robber HOT 2
- Want to add word limit counter using html, css and js HOT 2
- A script for fetching and storing all the companies listed on BSE & NSE. HOT 1
- Basic introduction of various functions of Pandas library HOT 2
- Alternative Sorting HOT 1
- Largest Palindrome Problem HOT 2
- Deleting whole Linked List in CPP HOT 3
- I would like to add a Longest Palindromic Subsequence Problem
- Adding More problems
- Adding bubble sort in java folder HOT 2
- Euclid’s Algorithm to find GCD of two numbers in C
- Can I add ReactJs Project HOT 2
- Adding Css to the calculator HOT 6
- sorting programs in java HOT 6
- ping pong game using python HOT 2
- Palindrome Linked List HOT 5
- Bank Management System Using React.js and Firebase HOT 1
- Add a full stack project HOT 2
- Car rental system HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hacktoberfest2022-for-everyone.