Example Of Dynamic Programming Algorithm Optimization