C++ || No Sorting || O(N) || O(1)
Code\n\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        // Intuition\n        // The idea in here is pretty simple. We will find the
# Code\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        // Intuition\n        // The idea in here is pretty simple. We will find the maximum two elemens of the nums vector and then return the required answer.\n        int firstMax  = -1;\n        int secondMax = -1;\n        for(auto &ele : nums){\n            if(ele > firstMax) {\n                secondMax = firstMax;\n                firstMax  = ele;\n            }\n            else if(ele > secondMax) secondMax = ele;\n        }\n        return (firstMax - 1) * (secondMax - 1);\n    }\n};\n```
['C++']