Java Simple Solution, using Sorting
Intuition\n Describe your first thoughts on how to solve this problem. \nIntuition was to sort the array and get the product\n\n# Approach\n Describe your appro
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIntuition was to sort the array and get the product\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nI used sorting because we know that after sorting largest 3 elements will have maximum product or 2 leftmost elements when multiplied with rightmost element will give maximum product. After finding left and right product, we use Math.max function to get maximum of these 2.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maximumProduct(int[] nums) {\n        int n = nums.length;\n        Arrays.sort(nums);\n        int r = nums[n-1] * nums[n-2] * nums[n-3]; //to check right subarray\n        int l = nums[0] * nums[1] * nums[n-1]; //to check left subarray\n        return Math.max(l,r);\n    }\n}\n```
['Java']