how to solve one max problem