this is the link of my implementation.
I have implemented the code but it is not accepting it except the given example
@akash.91.yadav
This is how you should approach the problem.
There are two possible cases for the subarray:
The subarray is inside the original array {x x x (x x x x) x x x}
The subarray spans the end of the original array {x x x) x x x x (x x x}
The second case can be considered as the sum of two subarrays in the original array:
{(x x) x x x x x (x x x)}
or the sum of the original array minus the sum of the subarray in the middle:
{x x (x x x x x) x x x}
Therefore, the max subarray sum in this case = sum(A) - minSubarraySum(A)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.