Greedy Approach
# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```csharp []\npublic class Solution {\n    public int MinimumSum(int[] nums) {\n        int n = nums.Length;\n        int[] left = new int[n];\n        int[] right = new int[n];\n        int sum = Int32.MaxValue;\n\n        left[0] = Int32.MaxValue;\n        right[n - 1] = Int32.MaxValue;\n\n        for (int i = 1; i < n; i++) {\n            left[i] = Math.Min(left[i - 1], nums[i - 1]);\n        }\n\n        for (int i = n - 2; i >= 0; i--) {\n            right[i] = Math.Min(right[i + 1], nums[i + 1]);\n        }\n\n        for (int i = 1; i < n - 1; i++) {\n            if (nums[i] > left[i] && nums[i] > right[i]) {\n                sum = Math.Min(sum, left[i] + nums[i] + right[i]);\n            }\n        }\n\n        return sum == Int32.MaxValue ? -1 : sum;\n    }\n}\n```
['Array', 'Greedy', 'C#']