more dp and recursive