diff --git a/MaxSubarraySum.cpp b/MaxSubarraySum.cpp new file mode 100644 index 00000000..556ea67c --- /dev/null +++ b/MaxSubarraySum.cpp @@ -0,0 +1,34 @@ +//Time Complexity : O(N) +//Space Complexity : O(1) + +#include +using namespace std; + +int maxSubArraySum(int arr[], int size) +{ + int max_sum = INT_MIN, ending_index = 0; + + for(int i=0; i