update readme
optimize algorithm with dynamic programming