Ruby code Polynomial O(N-cubed) time O(1) Space
Intuition and Approach\nSee description\n\n# Complexity\n- Time complexity:\nO(pow(N,3)) Time\n\n- Space complexity:\n O(1) Space Iterative Approach\n\n# Code\n
# Intuition and Approach\nSee description\n\n# Complexity\n- Time complexity:\nO(pow(N,3)) Time\n\n- Space complexity:\n O(1) Space Iterative Approach\n\n# Code\n```ruby []\n# @param {Integer[]} nums\n# @return {Integer}\ndef minimum_sum(nums)\n    # Is Ruby OOP?\n    # how many PLs represent infinity as a float ( Ruby does )?\n    # This PL reminds me well of BASIC\n    globalMin = Float::INFINITY\n    foundTriplet = false\n    n = nums.length() - 1\n    for i in 0..n do\n        for j in (i+1)..n do\n            for k in (j+1)..n do\n                elOne = nums[i]\n                elTwo = nums[j]\n                elThree = nums[k]\n                # auto add new line end of message\n                # print : no desire for new line behavior\n                # vals = [elOne,elTwo,elThree]\n                # puts "elOne = ${nums[i]}"\n                # puts "elTwo = ${nums[j]}"\n                # puts "elThree = ${nums[k]}"\n                # puts vals\n                if elOne < elTwo && elThree < elTwo \n                    tripletSum = elOne + elTwo + elThree\n                    foundTriplet = true\n                    globalMin = (globalMin < tripletSum) ? globalMin : tripletSum\n                    # enum = [globalMin,tripletSum]\n                    # globalMin = enum.min(1) { |a, b| a<=>b }\n                end\n            end\n        end\n    end\n    retVal = (foundTriplet) ? globalMin : -1\n    return retVal\nend\n```
['Array', 'Ruby']