AKUNA CAPITAL Interview Question

I got something similar to Leetcode's Maximum Subarray.