Here maximum product can be product of (3 largest +ve number) or (2 +ve and 1 lowest -ve number) or in case all are -ve then also code works.

```
class Solution {
public:
int maximumProduct(vector<int>& nums)
{
int n = nums.size();
sort(nums.begin(),nums.end());
return max( (nums[n-1]*nums[n-2]*nums[n-3]), (nums[0]*nums[1]*nums[n-1]) );
}
};
```