Java || Brute Force || beats 100% || 1ms || T.C - O(N^2) S.C - O(1)
\n\tpublic int findLengthOfShortestSubarray(int[] arr) {\n\n\t\tint len = arr.length, si = -1, ei = -1, min = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < len - 
\n\tpublic int findLengthOfShortestSubarray(int[] arr) {\n\n\t\tint len = arr.length, si = -1, ei = -1, min = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < len - 1; i++) {\n\t\t\tint m = arr[i + 1] - arr[i];\n\t\t\tif (m < 0) {\n\t\t\t\tsi = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (si == -1)\n\t\t\treturn 0;\n\n\t\tfor (int i = len - 1; i >= 1; i--) {\n\t\t\tint m = arr[i - 1] - arr[i];\n\t\t\tif (m > 0) {\n\t\t\t\tei = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (len - si - 1 < min)\n\t\t\tmin = len - si - 1;\n\n\t\tif (ei < min)\n\t\t\tmin = ei;\n\n\t\tfor (int i = 0; i <= si; i++) {\n\t\t\tfor (int j = ei; j < len; j++) {\n\t\t\t\tif (arr[j] >= arr[i]) {\n\t\t\t\t\tif (j - i - 1 < min)\n\t\t\t\t\t\tmin = j - i - 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn min;\n\t}
[]