solve dp problems