A parametric solution algorithm for a class of rank-two nonconvex programs