C++ {Speed,Mem} = {O(n), O(1)} simple
\nclass Solution {\npublic:\n    int maximumProduct(vector<int>& nums) {\n        \n        \n        int min_c = INT_MAX;\n        int min_n = INT_MAX;\n      
```\nclass Solution {\npublic:\n    int maximumProduct(vector<int>& nums) {\n        \n        \n        int min_c = INT_MAX;\n        int min_n = INT_MAX;\n        int max_c = INT_MIN;\n        int max_n = INT_MIN;\n        int max_n_n = INT_MIN;\n        \n        for(int i=0; i < nums.size(); i++){\n            // 2 smallets elements\n            if(min_c > nums[i]){\n                min_n = min_c;\n                min_c = nums[i];\n                \n            }\n            else if (min_n > nums[i])\n                min_n = nums[i];\n            \n            // 3 largest elements\n            if(max_c < nums[i]){\n                max_n_n = max_n;\n                max_n = max_c;\n                max_c = nums[i];\n            }\n            else if(max_n < nums[i]){\n                max_n_n = max_n;\n                max_n = nums[i];\n            }\n            else if(max_n_n < nums[i])\n                max_n_n = nums[i];\n        }\n        \n        return max(min_c*min_n*max_c, max_n_n*max_n*max_c);\n    }\n};\n```
['C', 'C++']