Simple Java Solution || T.C = O(n), S.C. = O(1)
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maxProduct(int[] nums) {\n        int max1=0 , max2=0;\n        for(int i=0;i<nums.length;i++){\n            if(nums[i] >= max1){\n                max2 = max1;\n                max1 = nums[i];\n            }\n            else max2 = Math.max(max2, nums[i]);\n        } \n        return (max1-1)*(max2-1);\n    }\n}\n```
['Java']