c++ solution using two pointer approach
\nclass Solution {\npublic:\n    int findLengthOfShortestSubarray(vector<int>& arr)\n    {\n        int n=arr.size();\n        int l=0;\n        int r=n-1;\n   
```\nclass Solution {\npublic:\n    int findLengthOfShortestSubarray(vector<int>& arr)\n    {\n        int n=arr.size();\n        int l=0;\n        int r=n-1;\n        while(l+1<n&&arr[l]<=arr[l+1])\n        {\n            l++;\n        }\n        if(l==n-1)\n        {\n            return 0;\n        }\n        while(r>=l&&arr[r-1]<=arr[r])\n        {\n            r--;\n        }\n        int ans=min(n-l-1,r);\n        int i=0;\n        int j=r;\n        while(i<=l&&j<n)\n        {\n            if(arr[i]<=arr[j])\n            {\n                ans=min(ans,j-i-1);\n                i++;\n            }\n            else\n            {\n                j++;\n            }\n        }\n        return ans;\n    }\n};\n```
[]