✅Java Simple Solution || ✅Runtime 0ms || ✅ Beats100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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 = nums[0];\n        int max2 = nums[1];\n\n        for (int i = 2 ; i < nums.length ; i++) {\n            if (nums[i] > max1){\n                max2 = (max1 > max2) ? max1 : max2;\n                max1 = nums[i];\n            }else if (nums[i] > max2){\n                max1 = (max2 > max1) ? max2 : max1;\n                max2 = nums[i];\n            }\n        }\n        return (max1 - 1 ) * (max2 - 1);\n    }\n}\n```\n\n\n## For additional problem-solving solutions, you can explore my repository on GitHub: [GitHub Repository](https://github.com/ahmedna126/java_leetcode_challenges)\n\n\n![e78315ef-8a9d-492b-9908-e3917f23eb31_1674946036.087042.jpeg](https://assets.leetcode.com/users/images/3ce469d3-c814-4e31-9025-a00854c8f82a_1690898529.9669943.jpeg)\n
['Java']