A=B
评价数不足
Coloured Triangles
   
奖励
收藏
已收藏
取消收藏
标签: level
文件大小
发表于
更新日期
105.670 KB
2022 年 7 月 12 日 上午 7:38
2022 年 7 月 12 日 上午 7:39
2 项改动说明 ( 查看 )

订阅以下载
Coloured Triangles

描述
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
热门讨论 查看全部(1)
0
2024 年 2 月 19 日 上午 1:37
Solution 11/17
295820878
2 条留言
SoMall-dumpling  [作者] 2 月 28 日 下午 11:48 
Good job! That's genius.
カズエイ 2 月 28 日 下午 11:39 
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