thoughts for using DP
algo pass the judge
sol of q090