Testsigma interview question

Max sum from the sub array,valid paranthasis