Leet Code 刷题笔记 - - 不求最快最省,但求最短最优雅,Shorter is better here. - SuperheroMovie00/Shortest-LeetCode-Python-Solutions
581. Shortest Unsorted Continuous Subarray 2行 class Solution: def findUnsortedSubarray(self, nums: List[int]) -> int: diff = [i for i, (a, b) in enumerate(zip(nums, sorted(nums))) if a != b] return len(diff) and max(diff) - min(diff) + 1 获取所有当前数组与排序后数组具有...