DP problem solutions