WalkMe interview question

writing an algorithm that returns the minimal subarray.