Meta interview question

Substrings and subarray optimization problem