[dp] triangle

calculate from back to front