A colored triangle is created from a row of colors ( B , G , or R ).
Successive rows, each containing one fewer color than the last, are generated by considering the two touching colors in the previous row. If these colors are identical, the same color is used in the new row; if they are different, the missing color is used in the new row.
This is continued until the final row with only a single color is generated, as illustrated below.
1 2 3 4 5 6 |
|
What will be the last color with this 1000 color row?
Note: Want to try a much harder version of this problem? Check it out on CodeWars .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Simple Python Solution :