Python DFS solution
Code\npython [DFS]\nclass Solution:\n    def minimumSum(self, nums: List[int]) -> int:\n        def dfs(i, j, k):\n            nonlocal total\n            if (i
# Code\n```python [DFS]\nclass Solution:\n    def minimumSum(self, nums: List[int]) -> int:\n        def dfs(i, j, k):\n            nonlocal total\n            if (i, j, k) not in visited:\n                visited.add((i, j, k))\n                if nums[i] < nums[j] > nums[k]:\n                    total = min(total, nums[i] + nums[j] + nums[k])\n                for kk in range(k + 1, length):\n                    dfs(i, j, kk)\n                for jj in range(j + 1, k):\n                    dfs(i, jj, k)\n                for ii in range(i + 1, j):\n                    dfs(ii, j, k)\n\n        length = len(nums)\n        total = inf\n        visited = set()\n        dfs(0, 1, 2)\n        return -1 if total == inf else total\n        \n```
['Python3']