Added max product algorithm.