Emma from St Paul's Girls' School sent in a very good solution. She says:

For two differently coloured rods, there are 2 ways you can line them up end to end:R-Y

Y-R

If the two rods are the same colour however there is only 1 way in which they can be lined up end to end:

R-R (or Y-Y depending on what colour they are)

For three differently coloured rods, there are 6 ways to line them up end to end:

R-G-P

R-P-G

P-G-R

P-R-G

G-P-R

G-R-P

If two of these rods are the same colour - let them be red - there are 3 ways in which the rods can be lined up end to end:

R-R-P

R-P-R

P-R-R

If all the rods are the same colour - let them be red - there is only 1 way in which they can be lined up end to end:

R-R-R

When there are four differently coloured rods there are 24 ways in which they can be lined up end to end:

A-B-C-D

A-B-D-C

A-C-B-D

A-C-D-B

A-D-B-C

A-D-C-B

x4 (because of when B, C and D are first in the line of rods)

When two of the rods are the same colour there are 18 ways in which the four rods can be lined end to end:

A-A-B-C

A-A-C-B

A-B-A-C

A-B-C-A

A-C-A-B

A-C-B-A

x3 (because of when B and C are first in the line)

Are you sure that when B is first in the line there will be six ways, Emma? Remember that there are two As... Perhaps someone else can help here?

When three of the four rods are the same colour there are 4 ways they can be placed end to end:A-A-A-B

A-A-B-A

A-B-A-A

B-A-A-A

When they are all the same colour there is again only one way in which the rods can be lined:

A-A-A-A

Very well done, Emma, you have gone about this in a very ordered way.