dp_prob_2 non-recursive