dp[i]=true. Case 2. L is at the left end of a block The block has the form [L,x1,x2,…,xL] and starts at position i.
• The block length is again L+1.
• It covers positions i,i+1,…,i+L. • The prefix before this block ends at i−1. This move is valid if • i+L≤n • dp[i−1]=true If both hold, then dp[i+L]=true. You try both cases for every i from 1 to n and update dp wherever you find a valid split.