Simple Solution || Beats 100% || 0(n) time ||0(1) space
you can also use sorting method but that takes o(nlogn) time\n# Below code take o(n) time\n# Please upvote if you feel it easy\n# Code\n\nclass Solution {\n    
# you can also use sorting method but that takes o(nlogn) time\n# Below code take o(n) time\n# Please upvote if you feel it easy\n# Code\n```\nclass Solution {\n    public int maxProduct(int[] nums) {\n        int first=0;\n        int second=0;\n        for(int i=0;i<nums.length;i++) {\n            if(nums[i]>first) {\n                second = first;\n                first = nums[i];\n            }\n            else if(nums[i]>second) {\n                second = nums[i];\n            }\n        }\n        return (first-1)*(second-1);\n\n    }\n}\n```
['Java']