Heap Java Solution
\nclass Solution {\n    public int maxProduct(int[] nums) {\n        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());\n        for (
```\nclass Solution {\n    public int maxProduct(int[] nums) {\n        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());\n        for (int i =0;i<nums.length;i++){\n            pq.add(nums[i]);\n        }\n\n        int n1 = pq.poll();\n        int n2 = pq.poll();\n\n        return (n1-1)*(n2-1);\n    }\n}\n```
[]