add comments for dp solution