half of all starting configurations are unable to end with all cards up and in fact will end with UUUUUUUUUUUUUUUUUUUD.
That is why the starting configuration is explicitly given as: “Twenty random cards are placed in a row all face down”.
If the number of starting face down cards is odd, then it will terminate with the last card as down and the rest as up. If the number of starting face down cards is even, then it will terminate with all the cards face up.
Oops, misread the problem statement. Of course you’re right. (Though I think the problem is made slightly more interesting if you allow starting with an arbitrary configuration.)
That is why the starting configuration is explicitly given as: “Twenty random cards are placed in a row all face down”. If the number of starting face down cards is odd, then it will terminate with the last card as down and the rest as up. If the number of starting face down cards is even, then it will terminate with all the cards face up.
Oops, misread the problem statement. Of course you’re right. (Though I think the problem is made slightly more interesting if you allow starting with an arbitrary configuration.)