EASY AND NAIVE SOLUTION USING C++
Intuition\n Describe your first thoughts on how to solve this problem. \nNO NEED OF SORTING\n# Approach\n Describe your approach to solving the problem. \nTwo V
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nNO NEED OF SORTING\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTwo Variable and one time traversal to array.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ --> O(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution {\npublic:\n    int maxProduct(vector<int>& nums) {\n        int a = INT_MIN;\n        int b = INT_MIN;\n\n        for(int i = 0 ; i < nums.size() ; i++)\n        {\n            if(b<nums[i])\n            {\n                if(a<nums[i])\n                {\n                    b = a ;\n                    a = nums[i];\n                }\n                else\n                b = nums[i];\n            }\n        }\n        return (a-1)*(b-1);\n    }\n};\n```
['Array', 'C++']