BEST C++ SOLUTION || BEATS 100% || EASY EXPLANATION || 
IntuitionFind the three largest numbers.Find the two smallest numbers (to handle cases with negative numbers).Compute both possible products:largest1 * largest2
# Intuition
Find the three largest numbers.
Find the two smallest numbers (to handle cases with negative numbers).
Compute both possible products:
largest1 * largest2 * largest3
smallest1 * smallest2 * largest1
Return the maximum of the two.

# Approach
Instead of sorting (which is O(N log N)), we can find the top three maximum numbers in a single pass (O(N)) using three variables:

Step 1: Maintain Three Variables
max1 → Largest number
max2 → Second largest
max3 → Third largest
Every time you iterate through nums, update them accordingly.

Step 2: Also Track Two Smallest Numbers
Since two negative numbers can give a large positive product, we also need:

min1 → Smallest number
min2 → Second smallest

Approach: Updating Values on the Go
For each num in nums:
>If num is greater than max1, shift all down (max3 = max2, max2 = max1, max1 = num).
>Else if num is greater than max2, shift down (max3 = max2, max2 = num).
>Else if num is greater than max3, update max3 = num.
>If num is smaller than min1, shift (min2 = min1, min1 = num).
>Else if num is smaller than min2, update min2 = num.

Once you get max1, max2, max3, min1, min2, the maximum product is:
max(max1 * max2 * max3, min1 * min2 * max1)


# Complexity
- Time complexity:
O(N)

- Space complexity:
O(1)


DO UPVOTE !!!!!!
# Code
```cpp []
class Solution {
public:
    int maximumProduct(vector<int>& nums) {
        int max1 = INT_MIN, max2 = INT_MIN , max3 =INT_MIN;
        int min1 = INT_MAX , min2 = INT_MAX;
        for( int num : nums){
            if(num > max1){
                max3= max2;
                max2 = max1;
                max1 = num;
            }
            else if(num > max2){
                max3 = max2;
                max2 = num ;
            }
            else if(num > max3){
                max3 = num;
            }
            if(num < min1){
                min2 = min1;
                min1 = num;
            }
            else if(num < min2){
                min2 = num;
            }
        }
        long long option1 = (long long)max1 * max2 * max3;
        long long option2 = (long long)min1 * min2 * max1;
         return max(option1, option2);
      
    }
};
 /*sort(nums. begin(), nums.end());
        int n = nums.size();
        int ch1= (nums[n-1] * nums[n-2] * nums[n-3]);
        int ch2 = (nums[0] * nums[1] * nums[n-1]);
        return max(ch1 , ch2);*/
```
['C++']