C# solutions w/ explaination
There are 3 cases of the input array. And the conclusion is the maximun product is generated by either the 3 largest number or the largest number and 2 smallest
There are 3 cases of the input array. And the conclusion is **the maximun product is generated by either the 3 largest number or the largest number and 2 smallest numbers.**\n1. All numbers are negative.\n\tmax product  is generated by **the 3 largest negative numbers**.\n\te.g. [-4,-3,-2,-1]. max product = -3 * -2 * -1.\n2. All the numbers are positive.\n    max product is generated by the **3 largest positive numbers**.\n\te.g., [1,2,3,4,5]. max product = 3 * 4 * 5\n3. Array has mixed positive numbers and negative numbers\n    (a) Array has 1 positive number.\n\t\tmax product  is generated by **the largest positive number and 2 smallest negative numbers**.\n\t\te.g. [-4, -3, -2, 1]. max product = 1 * -4 * -3\n\t(b) Array has 2 positive numbers.\n\t\tmax product  is generated by **the largest positive number and 2 smallest negative numbers**.\n\t\te.g., [-4, -3, -2, 1, 2]. max product = 2 * -4 * -3\n\t(c) Array has 3 or more than 3 positive numbers.\n\t\tmax product is generated by the **3 largest positive numbers**, or by **the largest postive number and 2 smallest negative numbers**.\n\t\te.g., [1,2,3,-4]. max product = 1 * 2 * 3\n\t\te.g., [1,2,3,4,-4]. max product =  2 * 3 * 4\n\t\te.g., [1,2,3,-4,-5]. max product = 3 * -4 * -5\n\t\n**One pass solution O(n)**\n```\npublic class Solution {\n    public int MaximumProduct(int[] nums) {\n        \n        int max1 = Int32.MinValue, max2 = Int32.MinValue, max3 = Int32.MinValue, min1 = Int32.MaxValue, min2 = Int32.MaxValue;\n        \n        foreach(int num in nums)\n        {\n            // find max1, max2 and max3\n            if(num >= max1)\n            {\n                max3 = max2;\n                max2 = max1;\n                max1 = num;\n            }\n            else if(num >= max2)\n            {\n                max3 = max2;\n                max2 = num;\n            }\n            else if(num > max3)\n            {\n                max3 = num;\n            }\n            \n            // find min1 and min2\n            if(num <= min1)\n            {\n                min2 = min1;\n                min1 = num;\n            }\n            else if(num < min2)\n            {\n                min2 = num;\n            }\n        }\n        \n        return Math.Max(max1 * max2 * max3, min1 * min2 * max1);\n    }\n}\n```\n\n**Sort solution O(nlogn)**\n```\n    public int MaximumProduct(int[] nums) {\n        \n        if(nums == null || nums.Length < 3)\n            return 0;\n        \n        Array.Sort(nums);\n        \n        return Math.Max(nums[nums.Length - 1] * nums[nums.Length - 2] * nums[nums.Length - 3], nums[nums.Length - 1] * nums[0] * nums[1]);\n    }\n```
[]