Simple Java 2ms solution with comments
\npublic int findLengthOfShortestSubarray(int[] arr) {\n        int n = arr.length;\n        int j = n - 1;\n        //A[j....n] is monotone increasing\n       
```\npublic int findLengthOfShortestSubarray(int[] arr) {\n        int n = arr.length;\n        int j = n - 1;\n        //A[j....n] is monotone increasing\n        while(j > 0 && arr[j] >= arr[j - 1])\n            j--;\n        \n        int result = j;\n        for(int i = 0; i < j; i++) {\n            //A[0....i] is monotone increasing\n            if(i > 0 && arr[i - 1] > arr[i])\n                break;\n            \n            //compare arr[0...i] with arr[j] so that arr[0....i, j.....n] is monotone increasing\n            while(j < n && arr[i] > arr[j])\n                j++;\n            \n            result = Math.min(result, j - i - 1);\n        }\n        \n        return result;\n    }\n```
[]