Python O(n) solution || NO fancy one liner
\n\n# Complexity\n- Time complexity: O(n)\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\n# Complexity\n- Time complexity: $$O(n)$$\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 maximumProduct(self, vec: List[int]) -> int:\n        if len(vec) == 3:\n            return vec[0] * vec[1] * vec[2]\n        max1 = max2 = max3 = -1000 \n        min1 = min2 = 1000\n        for i in vec:\n            if i > max1:\n                max3 = max2\n                max2 = max1\n                max1 = i\n            elif i > max2:\n                max3 = max2\n                max2 = i\n            elif i > max3:\n                max3 = i\n            if i < min1:\n                min2 = min1\n                min1 = i\n            elif i < min2:\n                min2 = i\n        return max(max1 * max2 * max3, min1 * min2 * max1)\n```
['Array', 'Math', 'Python3']