Java | Find 2 max nums | Simple | Clean code
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\n    for (var n : nums) {\n      if (n > max1) {\n        max2 = max1;\n        max1 = n;\n      } else if (n > max2) {\n        max2 = n;\n      }\n    }\n    return (max1 - 1) * (max2 - 1);\n  }\n}\n```\nIf you like my solution, please upvote it!
['Array', 'Java']