Now, reverse the position of the cards (i.e. KQJ) in the least possible number of moves. In a valid move, a card can be moved left or right one position. This move may only place a card into an empty slot or onto a card of higher rank. For example, a J can be placed on a K, NOT vice-versa. Also, only the top card of the stack can be moved. (Note: Since a card only moves one place it may not 'skip over' another card.)
What is the least number of moves required if:
a) There are only three slots.
b) There is an empty slot to the left of the Jack (initial arrangement is JQK).
c) There is an empty slot to the right of the King (initial arrangement is JQK).