You can navigate the grid below from the topleft yellow circle to the bottomright yellow square by making only orthogonal (not diagonal) moves, going from one position to the next only if the shape and/or the color of the shape in the entered cell is the same as that of the cell you are leaving.

What path has the minimum number of moves without going through the same cell twice?

What path has the maximum number of moves without going through the same cell twice?
Using Daniel's "URDL" notation, I found a shorter minimum of only 18 moves: DDRDLDRDRURUURDDDR