Easy C++ Solution
class Solution {\npublic:\n\n    int maxProductDifference(vector& nums) {\n        int max1=0; \n\t\tint max2=0;\n        for(int i=0;imax1){\n              max
class Solution {\npublic:\n\n    int maxProductDifference(vector<int>& nums) {\n        int max1=0; \n\t\tint max2=0;\n        for(int i=0;i<nums.size();i++){\n             if(nums[i]>max1){\n              max1=nums[i];  \n\t\t       }\n\t     }\n        int count = 0 ;\n        for(int i=0 ; i<nums.size();i++){\n            if(nums[i]==max1){\n                count++;\n                }\n        }\n        if(count!=1){\n            max2=max1;\n        }\n       else {\n\t         for(int i=0;i<nums.size();i++){\n             if(nums[i]>max2 && nums[i]<max1){\n              max2=nums[i];   }\n\t\t\t  }\n\t  }\n       int min1=INT_MAX; int min2=INT_MAX ;\n        for(int i=0;i<nums.size() ;i++){\n            if(nums[i]<min1){\n                min1=nums[i];\n            }\n        }\n        int count2 = 0 ; \n        for(int i=0 ;i<nums.size() ;i++){\n            if(nums[i]==min1) count2++;\n        }\n        if(count2!=1){\n            min2 = min1 ; \n        }\n        else {\n            for(int i=0 ; i<nums.size() ;i++){\n                if(nums[i]<min2 && nums[i]>min1){\n                 min2=nums[i];}\n            }\n        }\n        return max1*max2 - min1*min2;\n    }\n};
['Array', 'C']