AKUNA CAPITAL interview question

I got something similar to Leetcode's Maximum Subarray.