diff --git a/C++/Data Structure/Kadane's Algorithm.cpp b/C++/Data Structure/Kadane's Algorithm.cpp new file mode 100644 index 000000000..fc4246203 --- /dev/null +++ b/C++/Data Structure/Kadane's Algorithm.cpp @@ -0,0 +1,22 @@ +class Solution{ + public: + // arr: input array + // n: size of array + //Function to find the sum of contiguous subarray with maximum sum. + long long maxSubarraySum(int arr[], int n){ + + // Your code here + long long maxi=INT_MIN; + long long sum=0; + for(int i=0;i