Two pointers || C++
\n\n    int findLengthOfShortestSubarray(vector<int>& a) {\n     \n        int n = a.size();\n        int low = 0, high = n-1;\n        \n        while( low+1 <
\n```\n    int findLengthOfShortestSubarray(vector<int>& a) {\n     \n        int n = a.size();\n        int low = 0, high = n-1;\n        \n        while( low+1 < n and a[low] <= a[low+1] )\n            low++;\n        \n        if(low == n-1) return 0;\n        \n        while(high > low and  a[high] >= a[high-1] )\n            high--;\n        \n        int ans = min(n-low-1, high);\n        \n        int i = 0, j = high;\n        \n        while(i<=low and j<n)\n        {\n            if( a[i] <= a[j] )\n            {\n                ans=min(ans, j-i-1);\n                i++;\n            }\n            else \n                j++;\n        }\n        \n        return ans;\n    }\n```
[]