public int maxProduct_neat(int[] nums) {
        if (nums.length == 0)
            return 0;
        if (nums.length == 1)
            return nums[0];
        int ans = nums[0], max = nums[0], min = nums[0];
        for (int i = 1; i < nums.length; ++i) {
            int mx = max, mn = min;
            int val = nums[i];
            min = Math.min(mn * val, Math.min(val, val * mx));
            max = Math.max(val, Math.max(mx * val, mn * val));
            ans = Math.max(ans, max);
        }
        return ans;
    }