Find shortest subarray to restore order | Amazon Interview Question