Beats 100% Java
Approach\n1. find the longest consecutive prefix increasing subarray\n2. find the longest consecutive suffix increasing subarray\n3. use the Monotonic Stack to 
# Approach\n1. find the longest consecutive prefix increasing subarray\n2. find the longest consecutive suffix increasing subarray\n3. use the Monotonic Stack to combine two subarrays.\n\n# Complexity\n- Time complexity:\n$$O(Nlog(N))$$\n\n- Space complexity:\n$$extra:O(1)$$\n$$total:O(N)$$\n\n# Code\n```java []\nclass Solution {\n    public int findLengthOfShortestSubarray(int[] arr) {\n        int pos = 0;\n        for (;pos < arr.length - 1; pos++) { // front incresing\n            if (arr[pos + 1] < arr[pos]) break;\n        }\n        int posBack = arr.length - 1;\n        for (;posBack > pos; posBack--) { // back increasing\n            if (arr[posBack] < arr[posBack - 1]) break;\n        }\n\n        if (pos == arr.length - 1) return 0;\n\n        // stack at [0, pos]\n        for (int i = posBack; i < arr.length; i++) {\n            if (arr[i] >= arr[pos]) break;\n            else {\n                int t = -1;\n                // jump binary search\n                for (int jump = pos + 1; jump > 0; jump /= 2) {\n                    while (t + jump <= pos && arr[t + jump] <= arr[i]) {\n                        t += jump;\n                    }\n                }\n                arr[t + 1] = arr[i];\n                posBack++;\n            }\n        }\n        return posBack - pos - 1;\n    }\n}\n```
['Java']