Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Wow, i aim for this level of skill
Great
Hey, thanks gotcha! If i'm not wrong this is an example of recursion.
The point of the for loop is to create the next row of the triangle by comparing every two adjacent characters.
The next row is stored in the variable reduced. In the 4th line two consecutive characters are compared, and if
they are the same, that character is added to reduced. If they are different, both are removed form the string 'RGB',
and the remaining character is added to reduced. Let's say row[i] = 'R' and row[i+1] = 'B'. First, 'RGB'.replace(row[i], '')
will return 'GB'. The second replace method will be called on 'GB'. It will replace 'B' with nothing and return 'G'.
Can somebody explain, what is happening in line number 4 , 'RGB'.replace(row[i], '').replace(row[i+1], '');