Kadane's Algorithm is an iterative dynamic programming algorithm. It calculates the maximum sum subarray ending at a particular position by using the maximum sum subarray ending at the previous position.
Problem Statement
Given an array arr[] of size N. The task is to find the sum of the contiguous subarray within a arr[] with the largest sum.
Examples
Input: [-3, -4, 5, -1, 2, -4, 6, -1]
Output: 8
Explanation: Subarray [5, -1, 2, -4, 6] is the max sum contiguous subarray with sum 8.
Fixes: #170
Type of change
[x] New feature (non-breaking change which adds functionality)
[x] This change requires a documentation update
Checklist:
[x] I have made this from my own
[x] I have taken help from some online resourses
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
Description
Kadane's Algorithm is an iterative dynamic programming algorithm. It calculates the maximum sum subarray ending at a particular position by using the maximum sum subarray ending at the previous position.
Problem Statement
Given an array arr[] of size N. The task is to find the sum of the contiguous subarray within a arr[] with the largest sum.
Examples
Input: [-3, -4, 5, -1, 2, -4, 6, -1] Output: 8 Explanation: Subarray [5, -1, 2, -4, 6] is the max sum contiguous subarray with sum 8.
Fixes: #170
Type of change
Checklist:
ATTACH SCREEN-SHOTS / DEPLOYMENT LINK
OUTPUT