improve code, it's greedy, not dp