Java O(n) solution, 100% faster
```\n public int maxProduct(int[] nums) {\n         int len = nums.length;\n        if(len == 1){\n            return nums[0];\n        }\n        int first = I
```\n public int maxProduct(int[] nums) {\n         int len = nums.length;\n        if(len == 1){\n            return nums[0];\n        }\n        int first = Integer.MIN_VALUE;\n        int second = Integer.MIN_VALUE;\n\n        if(len == 2){\n            return (nums[0]-1) * (nums[1]-1);\n        }\n       for(int i = 0 ; i < len; i++){\n          if(nums[i] >= second){\n              if(nums[i] >= first){\n                  second = first;\n                  first = nums[i];\n              }\n              else {\n                  second = nums[i];\n              }\n          }\n       }\n       return (first-1) * (second-1);\n    }
['Java']