A row of n bricks stands in front of you, each brick painted either black or white. One stroke of the brush repaints a contiguous part of the row in a single color. White paint turns every brick in the painted part white, and black paint turns every brick in the painted part black. The brush holds only so much paint at a time, so one stroke covers at most k consecutive bricks. Within that limit you may start a stroke anywhere in the row and use either color.
For example, take four bricks colored black, white, white, black, and suppose you want them to end up white, black, black, white. With k=4 two strokes are enough. Paint all four bricks white, then paint the middle two black.
Compute the minimum number of strokes needed to turn the initial row into the desired row. The cost of the paint does not matter.