WalkMe Interview Question

writing an algorithm that returns the minimal subarray.