If all the sides look the same and the centre cube is red, then the corner cubes are the only yellow ones. Since a cube has $8$ corners, there are $8$ yellow little cubes. Also, the drawn square has $3^3=27$ little squares and any of them is either yellow or red, so there are $27-8=19$ red little squares.
If we know only the colour of the little cubes we see, then, by counting them, we know that there are $7$ yellow cubesĀ and $12$ red ones. Therefore, there are $27-(7+12)=8$ cubes of unknown colour. The maximum number of red cubes would therefore be achieved if all the unknown colour cubes will be red, so the maximum number of red cubes is $20$, while the minimum number is achieved if all
the unknown colour cubes are yellow and the number of red ones is $12$.