Count minimum number of steps to destroy all blocks
A very similar  problem is the one of clearing the board in an instance of the Two-Dots that only has one column.
This is a single-player game played on a column of colored dots. A move consists of removing a contiguous group of at least two dots that all share the same color and then consolidating all remaining dots.
The goal is to clear the column in the fewest number of moves.
A dynamic programming algorithm for this problem is devised in section 4.2.1 of this paper.  As you suggest $C(i,j)$ is defined as the minimum number of moves needed to clear all (and only) the dots in rows $i$ through $j$.
Your problem has a couple of minor differneces:

A move always deletes a maximal (w.r.t. inclusion) monochromatic group of adjacent dots.
You can also remove a single &quot;dot&quot; if it doesn't match with any neighboring dot.

Here the constraint in 1) can be safely relaxed since it is the case that there is always an optimal solution for the Two-Dots problem that also satisfies such constraint.
To account for 2) you need to redefine $C(i,i) = 1$ (since a single dot can be removed with a single move) and
and, for $i&lt;j$, $C(i,j) = \min \{C_1(i,j), C_2(i,j), 1 + C(i+1,j) \}$ where $C_1$ and $C_2$ are as in the paper and $1 + C(i+1, j)$ considers the case where the first dot is not matched with anything in an optimal solution.