~15 min
Intuitionwe need to check every triplet of numbers, so we need three cyclesApproachthree cycles of i: 0, n; j: i + 1, n; k: j + 1, n;Complexity

Time complexity
# Intuition
we need to check every triplet of numbers, so we need three cycles

# Approach
three cycles of i: 0, n; j: i + 1, n; k: j + 1, n;

# Complexity
- Time complexity:
O(n^3), n - length of nums

- Space complexity:
O(1)

# Code
```typescript []
function minimumSum(nums: number[]): number {
    let sum = 999

    for (let i = 0; i < nums.length; ++i) {
        for (let j = i + 1; j < nums.length; ++j) {
            for (let k = j + 1; k < nums.length; ++k) {
                if (nums[i] < nums[j] && nums[j] > nums[k]) {
                    // console.log(i, j, k)
                    sum = Math.min(sum, nums[i] + nums[j] + nums[k])
                }
            }
        }
    }

    return sum === 999 ? -1 : sum
};
```
['TypeScript']