Maximize min+max of contiguous subarray | ByteDance Interview Question