Optimized, but intuitive Python approach O(n log n)
IntuitionWe need to find a "mountain" triplet (i, j, k) such that i < j < k, nums[i] < nums[j], and nums[k] < nums[j]. The goal is to minimize the sum nums[i] +
# Intuition
We need to find a "mountain" triplet `(i, j, k)` such that `i < j < k`, `nums[i] < nums[j]`, and `nums[k] < nums[j]`. The goal is to minimize the sum `nums[i] + nums[j] + nums[k]`. The idea is to treat `nums[j]` as the peak of the mountain and then select the smallest valid elements on its left and right that satisfy the conditions.

# Approach
1. **Left Candidate:**  
   As we iterate through the array, we maintain the minimum value to the left of the current index (`min_left`). For a valid mountain, `min_left` must be less than `nums[j]`.

2. **Right Candidate:**  
   To efficiently find the smallest element to the right of index `j` that is less than `nums[j]`, we use a min-heap. The heap is initially built with pairs `(nums[i], i)` for all indices starting from `2`. For each potential peak index `j`, we remove from the heap any elements that are not to its right (i.e., with index `<= j`). If the smallest element in the heap is less than `nums[j]`, it serves as the right candidate.

3. **Updating the Answer:**  
   For each index `j` (from `1` to `n-2`), if both left and right candidates exist, we compute the mountain sum and update the minimum sum accordingly.

# Complexity
- Time complexity: $$O(n \log n)$$  
  We perform a single pass over the array (O(n)) and for each peak, we may perform heap operations (O(log n)).

- Space complexity: $$O(n)$$  
  The heap may store up to O(n) elements, and we maintain a few extra variables.

# Code
```python3
from typing import List
import heapq

class Solution:
    def minimumSum(self, nums: List[int]) -> int:
        n = len(nums)
        if n < 3:
            return -1

        # Build a min-heap for the right side using pairs (value, index)
        right_heap = [(nums[i], i) for i in range(2, n)]
        heapq.heapify(right_heap)

        min_left = nums[0]  # Minimum element to the left of the current index
        min_sum = float('inf')
        
        # Iterate over possible peak indices (from 1 to n-2)
        for j in range(1, n - 1):
            # Remove elements from the heap that are not to the right of j
            while right_heap and right_heap[0][1] <= j:
                heapq.heappop(right_heap)
            
            # Left candidate: must be less than the current element
            left_candidate = min_left if min_left < nums[j] else None
            
            # Right candidate: the smallest element to the right that's less than the current element
            right_candidate = right_heap[0][0] if right_heap and right_heap[0][0] < nums[j] else None
            
            # If both candidates exist, update the minimum mountain sum
            if left_candidate is not None and right_candidate is not None:
                min_sum = min(min_sum, left_candidate + nums[j] + right_candidate)
            
            # Update the minimum element to the left for the next iteration
            min_left = min(min_left, nums[j])
        
        return min_sum if min_sum != float('inf') else -1
```
['Heap (Priority Queue)', 'Python3']