【Leetcode】581. Shortest Unsorted Continuous Subarray

Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.

You need to find the shortest such subarray and output its length.

1 使用双指针,一个从前往后找,一个从后往前找;从前往后找的,找到第一处数值下降的地方;从后往前找,找到第一处上升的地方

你可能感兴趣的:(【Leetcode】581. Shortest Unsorted Continuous Subarray)