Given an array of integers, write a method to find indices m and n such that if you sorted elements m through n, the entire array would be sorted. Minimize n - m
(that is, find the smallest such sequence).
Return [m,n]
. If there are no such m and n (e.g. the array is already sorted), return [-1, -1].
Example:
Input: [1,2,4,7,10,11,7,12,6,7,16,18,19] Output: [3,9]
Note:
0 <= len(array) <= 1000000