Accepted Java O(N), O(1) (beats 100%)
\nTime : O(N)\nSpace : O(1)\nIterate array\n    1.) if cur val is more than max1, put curr val in max1 and max1 val in max2\n    2.) else if curr val is more th
\nTime : O(N)\nSpace : O(1)\nIterate array\n    1.) if cur val is more than max1, put curr val in max1 and max1 val in max2\n    2.) else if curr val is more than max2, put curr val in max2\n\n```\nclass Solution {\n    public int maxProduct(int[] nums) {\n        int max1 = 0;\n        int max2 = 0;\n        for(int i:nums){\n            if(i>max1){\n                max2 = max1;\n                max1 = i;\n            }\n            else if(i>max2){\n                max2 = i;\n            }\n        }\n        return (max1-1)*(max2-1);\n    }\n}\n```
['Java']