roll array optimize the 1185 dp problem