Maximum Subarray ProblemProblem Statement You are given an array of integers. And, you have find the…