100%Beats| Java| SC: O(1)|Optimized Wayt
Intuition\n Describe your first thoughts on how to solve this problem. \nUsing three pointers we can solve. i, j and k  \n\n# Approach\n Describe your approach 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nUsing three pointers we can solve. i, j and k  \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n^3)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution {\n    public int minimumSum(int[] nums) {        \n        int n = nums.length;\n        int min = Integer.MAX_VALUE;\n        for(int i=0; i<n; i++){\n            int j = i+1;\n            int k = j+1;\n            while(j<n && k< n){\n                if(nums[i] < nums[j] && nums[k] < nums[j]){\n                    int sum = nums[i] + nums[j] + nums[k];\n                    min = Math.min(min, sum);                   \n                }\n                 k++;\n                if (k >= n) {\n                    j++;\n                    k = j + 1;\n                }\n            }\n        }\n        return min == Integer.MAX_VALUE ? -1 : min;        \n    }\n}\n```
['Two Pointers', 'Iterator', 'Java']