Determine the final answer
Here the fourth step is also simple: if the whole array can be split into valid blocks, then the answer is YES if , and NO otherwise.
So the only missing piece is the transition (how depends on earlier dp values). Before moving to the next unit, try to think: given this definition of , how do you find which earlier states matter?