Sending a Sequence Over the Network, Idea and Intuition This is your first DP problem where dp[i] represents whether a prefix is valid of the array instead of values or indices in the usual sense.
You are given a sequence You want to cut it into blocks. Each block must look like one of these two patterns:
Length on the left
Length on the right
So every block contains exactly one number and exactly other numbers. The whole array must be covered by such blocks, without overlapping and without leaving anything out.
Now that you understand what the problem is asking, let us think about how to approach it.