dynamic programming, last time init situation wrong, revised it, good