O(N) TC  + O(1) SC easy solution just based on sorted array logic
```\n int findLengthOfShortestSubarray(vector& arr) {\n        int start=0;\n        int n=arr.size();\n        int end=n-1;\n        int ans=INT_MAX;\n        
```\n int findLengthOfShortestSubarray(vector<int>& arr) {\n        int start=0;\n        int n=arr.size();\n        int end=n-1;\n        int ans=INT_MAX;\n        for(int i=0;i<n-1;i++){\n            if(arr[i]<=arr[i+1])\n                start=i+1;\n            else\n                break;\n        }\n        if(start==n-1)\n            return 0;\n        for(int i=n-1;i>0;i--){\n            if(arr[i-1]<=arr[i])\n                end=i-1;\n            else\n                break;\n        }\n        if(end==0)\n            return n-1;\n        ans=min(n-start-1,end);\n        int i=0;\n        int j=end;\n        while(i<=start and j<n){\n            if(arr[i]<=arr[j]){\n                ans=min(ans,j-i-1);\n                i++;\n            }\n            else\n                j++;\n        }\n        \n        return ans;\n    }
[]