easy and simple approach with time complexity O(N) and O(1) Python ||array||triplet sum
Intuition\n Describe your first thoughts on how to solve this problem. \nwe have to find a triplet (i,j,k).where nums[j]>nums[i] and nums[j]>nums[k].\n\n# Appro
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nwe have to find a triplet (i,j,k).where nums[j]>nums[i] and nums[j]>nums[k].\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n-> first we have target on mid element (nums[j]) \n->if mid element index is j then we have to find nums[i] it should be minimum among all elements from left part til i th index\n-> same as that from j+1 index we have to find min element \n-> at last we should check nums[left_min]<nums[mid] and nums[rigt_min]<nums[mid] \n-> then we have take the sum of these \n-> at last return the minimum sum among all outputs\n\n# Complexity\n- Time complexity:O(n^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minimumSum(self, nums: List[int]) -> int:\n        a=nums[0]\n        b=nums[-1]\n        sum1=10**9\n        l=[]\n        r=[]\n        l.append(0)\n        for i in range(1,len(nums)-1):\n            left=min(nums[:i])\n            right=min(nums[i+1:])\n            if nums[i]>left and nums[i]>right:\n                sum1=min(sum1,nums[i]+left+right)\n        if sum1==10**9:\n            return -1 \n        else:\n            return sum1\n```
['Array', 'Suffix Array', 'Prefix Sum', 'Python', 'Python3']