This reminded me of those block puzzles that I used to play on my calculator during high school. It definitely triggered some pleasant nostalgia.
I felt like that ending was a bit of a curveball. My inclination says that I should be able to do something clever, but the relative straightforwardness of the puzzles previously tells me that I really was just stuck.
Was I really just stuck at the end or is there a way to succeed?