Can you please check the code as the test cases are not passing?

you are using kadane’s in a wrong manner when it comes to finding the minimum sum, to find the minimum sum you have to multiply each element by -1 and then apply kadane’s again and then multiply the result by -1.
Please refer to the below given article to know more about how to use kadane to solve the given question:

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.