Max products subarray problem solved