Two-Pass Approach 
IntuitionMy initial thought on how to solve this problem was to iterate through the array and find all possible triplets that satisfy the mountain condition. Ho
# Intuition
My initial thought on how to solve this problem was to iterate through the array and find all possible triplets that satisfy the mountain condition. However, this approach would have a high time complexity due to the need to check all possible triplets. A more efficient approach would be to use a two-pointer technique or dynamic programming to reduce the time complexity.
# Approach
My approach to solving this problem is to use a dynamic programming technique to find the minimum sum of a mountain triplet. The idea is to maintain two arrays, leftMin and rightMin, to store the minimum values to the left and right of each index, respectively. Then, iterate through the array and check if the current element is greater than the minimum values to its left and right. If it is, update the minimum sum if necessary.
# Complexity
- Time complexity: $$O(n)$$
    - The time complexity is linear because we are iterating through the array three times: once to fill the leftMin array, once to fill the rightMin array, and once to find the minimum sum.

- Space complexity: $$O(n)$$
    - The space complexity is linear because we are using two arrays of size n to store the minimum values to the left and right of each index.

# Code
```cpp []
class Solution {
public:
    int minimumSum(vector<int>& nums) {
        int n = nums.size();
        int minSum = INT_MAX;
        bool found = false;

        vector<int> leftMin(n, INT_MAX);
        vector<int> leftIdx(n, -1);

        for (int i = 1; i < n; i++) {
            if (nums[i - 1] < leftMin[i - 1]) {
                leftMin[i - 1] = nums[i - 1];
                leftIdx[i - 1] = i - 1;
            }
            leftMin[i] = leftMin[i - 1];
            leftIdx[i] = leftIdx[i - 1];
        }

        vector<int> rightMin(n, INT_MAX);
        vector<int> rightIdx(n, -1);

        for (int i = n - 2; i >= 0; i--) {
            if (nums[i + 1] < rightMin[i + 1]) {
                rightMin[i + 1] = nums[i + 1];
                rightIdx[i + 1] = i + 1;
            }
            rightMin[i] = rightMin[i + 1];
            rightIdx[i] = rightIdx[i + 1];
        }

        for (int i = 1; i < n - 1; i++) {
            if (leftMin[i] != INT_MAX && rightMin[i] != INT_MAX &&
                nums[i] > leftMin[i] && nums[i] > rightMin[i]) {
                found = true;
                minSum = min(minSum, leftMin[i] + nums[i] + rightMin[i]);
            }
        }

        return found ? minSum : -1;
    }
};
```
['C++']