A=B
Not enough ratings
Coloured Triangles
   
Award
Favorite
Favorited
Unfavorite
Tags: level
File Size
Posted
Updated
105.670 KB
12 Jul, 2022 @ 7:38am
12 Jul, 2022 @ 7:39am
2 Change Notes ( view )

Subscribe to download
Coloured Triangles

Description
Input: A string of "R", "G" and "B".
Output: A coloured triangle is created from a row of colours, each of which is red, green or blue. Successive rows, each containing one fewer colour than the last, are generated by considering the two touching colours in the previous row. If these colours are identical, the same colour is used in the new row. If they are different, the missing colour is used in the new row. This is continued until the final row, with only a single colour, is generated.
The different possibilities are:
Color here: G G B G R G B R
Becomes colour: G R B G
With some bigger examples:
R G B R B R R R B G G R
B R G G R G R G B
G G B B B R
Output G R B G
Output R R
Output R
Constraint: 2 <= Input length <= 7
Popular Discussions View All (1)
0
19 Feb, 2024 @ 1:37am
Solution 11/17
295820878
2 Comments
SoMall-dumpling  [author] 28 Feb @ 11:48pm 
Good job! That's genius.
カズエイ 28 Feb @ 11:39pm 
10 lines (/17 lines)

ZY=YYYYYYYYYYYZ
YYYYYYYYYB=BYY
ZB=BZ
YYY=
R=BYY
G=BY
B=XZ
XYZ=(return)R
YZ=(return)G
Z=(return)B