JAVA || Clean & Concise Code || Two Pointer Technique || O(N) Time || 100% Optimal Solution
\nclass Solution {\n    public int findLengthOfShortestSubarray(int[] arr) {\n        \n        int i = 0, j = arr.length - 1;\n        \n        while (i < j &
```\nclass Solution {\n    public int findLengthOfShortestSubarray(int[] arr) {\n        \n        int i = 0, j = arr.length - 1;\n        \n        while (i < j && arr[i] <= arr[i + 1]) {\n            i++;\n        }\n        \n        if (i == arr.length - 1) {\n            return 0;\n        }\n        \n        while (j > 0 && arr[j] >= arr[j - 1]) {\n            j--;\n        }\n        \n        int minLength = Math.min (arr.length - i - 1, j);\n        int k = i;\n        i = 0;\n        \n        while (i <= k && j < arr.length) {\n            if (arr[i] <= arr[j]) {\n                minLength = Math.min (minLength, j - i - 1);\n                i++;\n            }\n            else {\n                j++;\n            }\n        }\n        \n        return minLength;\n    }\n}\n```\n\nPlease help to **UPVOTE** if this post is useful for you.\nIf you have any questions, feel free to comment below.\n\n**LOVE CODING :)\nHAPPY CODING :)\nHAPPY LEARNING :)**
['Two Pointers', 'Java']