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.
but in the first test case yellow also didnt connect but yellow wins
Test.assert_equals(who_is_winner([ "C_Yellow", "E_Red", "G_Yellow", "B_Red", "D_Yellow", "B_Red", "B_Yellow", "G_Red", "C_Yellow", "C_Red", "D_Yellow", "F_Red", "E_Yellow", "A_Red", "A_Yellow", "G_Red", "A_Yellow", "F_Red", "F_Yellow", "D_Red", "B_Yellow", "E_Red", "D_Yellow", "A_Red", "G_Yellow", "D_Red", "D_Yellow", "C_Red" ]), "Yellow")
im a little confused
letters is a list of all the different letters in the string, and the for loop is just repeatedly looking a the triplets
eg. if triplets=[[1,2],[3,4]] then letters is a list containing 1,2,3,4 in any order, and t will be [1,2] and [3,4], 4 times each
for the rest of the test cases did you TLE? because seems like the parts that go "array[a][b] not in res" is going to be O(n-squared) time complexity due to searching through the whole array every time you try to put something in.
if its TLE, try to think of a faster algo?
my syntax highlighting looks the same as the expected highlighing(color wise), but not sure why its wrong lol. in the section below the log i see 2 extra FF right after an opening square bracket but im not sure why theyre there. someone help please? :)
agreed! but good readability though
str1[-1] == ' ' and str1 != ''
actually if you had switched the positions of the 2 conditions above you would be fine, because then python would evaluate str1!='' first, and skip the str1[-1] once the first is not satisfied (ie. if str1 is empty). The error here occurred because it was trying to get the last character in an empty string
why is there double of the same card in the python test case :( have to relook at my class