Using Nested Loop
Code


# Code
```cpp []
class Solution {
public:
    int minimumSum(vector<int>& nums) {
        int n = nums.size();
        int sum = 0;
        int minSum = INT_MAX;
        int cnt = 0;
        for(int i=0;i<n-2;i++){
            for(int j=i+1;j<n-1;j++){
                for(int k=j+1;k<n;k++){
                    if(nums[i] < nums[j] and nums[k] < nums[j]){
                        sum = nums[i]+nums[j]+nums[k];
                        minSum = min(minSum,sum);
                        cnt++;
                    }
                }
            }
        }
        if(cnt > 0) return minSum;
        return -1;
    }
};
```
['C++']