C++ O(n)
\nclass Solution {\npublic:\n    int maxProduct(vector<int>& a) {\n        \n        int i,max1,max2;\n        max1=max2=INT_MIN;\n        for(int i=0;i<a.size(
```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& a) {\n        \n        int i,max1,max2;\n        max1=max2=INT_MIN;\n        for(int i=0;i<a.size();i++){\n            if(a[i]>max1){\n                max2 = max1;\n                max1 = a[i];\n            }\n            else if(a[i]>max2){\n                max2 = a[i];\n            }\n        }\n        int ans = (max1-1) * (max2-1);\n        return ans;\n    }\n};\n```
[]