add dp solution according to winnie