Decorate-Sort-Undecorate DP