**Answer:** 13 yellow and 15 green bricks.

We are after Y lots of 19 plus G lots of 21 to equal 562.

19Y + 21G = 562

It is easiest to try different values for Y, until one gives an answer divisible by 21:

21G = 562 - 19Y

Y = 1 >> 21G = 562 - 19 = 543 x

Y = 2 >> 21G = 562 - 38 = 524 x

Y = 3 >> 21G = 562 - 57 = 505 x

Y = 4 >> 21G = 562 - 76 = 486 x

Y = 5 >> 21G = 562 - 95 = 467 x

Y = 6 >> 21G = 562 - 114 = 448 x

Y = 7 >> 21G = 562 - 133 = 429 x

Y = 8 >> 21G = 562 - 152 = 410 x

Y = 9 >> 21G = 562 - 171 = 391 x

Y = 10 >> 21G = 562 - 190 = 372 x

Y = 11 >> 21G = 562 - 209 = 353 x

Y = 12 >> 21G = 562 - 228 = 334 x

Y = 13 >> 21G = 562 - 247 = 315 OK

Y = 13, therefore G = 315 ÷ 21 = 15. QED.