basic dynaic programming solution (slow)
basic dynaic programming solution (slow)