its brute force approach ( correct this one)
And also suggest a optimised method
Please check why test cases are not passing
hello @rsumitaj test cases are not passing because the code which you are doing is not the optmised.
it is taking a lot of extra space as well as time.
hey @rsumitaj do you know about the kadanes algorithm?
it must be ther in your course you have to use that algorithm to solve this question.
if you have any doubt youcan ask here.
Happy Learning !!