Skip to content

Latest commit

 

History

History
58 lines (26 loc) · 872 Bytes

README_EN.md

File metadata and controls

58 lines (26 loc) · 872 Bytes

中文文档

Description

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

Solutions

Python3

Java

...