Simple java code 2ms
\n# Complexity\n- \n\n# Code\n\nclass Solution {\n    public int minimumSum(int[] arr) {\n        int min=222;\n        int flag=0;\n        int n=arr.length;\n
\n# Complexity\n- \n![image.png](https://assets.leetcode.com/users/images/3b65c1ec-b6c9-4453-9c19-6714b14a9b08_1703480103.7232757.png)\n# Code\n```\nclass Solution {\n    public int minimumSum(int[] arr) {\n        int min=222;\n        int flag=0;\n        int n=arr.length;\n        int i=0,j=1,k=2;\n        while(true){\n            if(arr[i]<arr[j]&&arr[j]>arr[k]){\n                flag=1;\n                int x=arr[i]+arr[j]+arr[k];\n                if(x<min){\n                    min=x;\n                }\n            }\n            if(k<n-1){\n                k++;\n            }\n            else if(j<k-1){\n                j++;\n                k=j+1;\n            }\n            else if(i<j-1){\n                i++;\n                j=i+1;\n                k=i+2;\n            }\n            else{\n                break;\n            }\n        }\n        if(flag==0){\n            return -1;\n        }\n\n        return min;\n    }\n}\n```
['Java']