[C++] Two Solutions
Sorting Solution\n\tclass Solution {\n\tpublic:\n\t\tint maximumProduct(vector& nums) {\n\t\t\tint n = nums.size();\n\t\t\tsort(nums.begin(), nums.end());\n\t\t
##### Sorting Solution\n\tclass Solution {\n\tpublic:\n\t\tint maximumProduct(vector<int>& nums) {\n\t\t\tint n = nums.size();\n\t\t\tsort(nums.begin(), nums.end());\n\t\t\treturn max(nums[n - 1] * nums[n - 2] * nums[n - 3], nums[0] * nums[1] * nums[n - 1]);\n\t\t}\n\t};\n##### Without Sorting Solution\n\tclass Solution {\n\tpublic:\n\t\tint maximumProduct(vector<int>& nums) {\n\t\t\tint max1 = INT_MIN, max2 = INT_MIN, max3 = INT_MIN;\n\t\t\tint min1 = INT_MAX, min2 = INT_MAX, min3 = INT_MAX;\n\t\t\tfor(int i = 0; i < nums.size(); i++){\n\t\t\t\tif(nums[i] <= min1){\n\t\t\t\t\tmin2 = min1;\n\t\t\t\t\tmin1 = nums[i];\n\t\t\t\t} \n\t\t\t\telse if(nums[i] <= min2){\n\t\t\t\t\tmin2 = nums[i];\n\t\t\t\t}\n\t\t\t\tif(nums[i] >= max1){ \n\t\t\t\t\tmax3 = max2;\n\t\t\t\t\tmax2 = max1;\n\t\t\t\t\tmax1 = nums[i];\n\t\t\t\t} \n\t\t\t\telse if(nums[i] >= max2){\n\t\t\t\t\tmax3 = max2;\n\t\t\t\t\tmax2 = nums[i];\n\t\t\t\t} \n\t\t\t\telse if(nums[i] >= max3){\n\t\t\t\t\tmax3 = nums[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn max(min1 * min2 * max1, max1 * max2 * max3);\n\t\t}\n\t};
['C', 'Sorting', 'C++']