well using list comprehension is more efficient as it only iterate through the characters one time but in this solution it iterate through the character 10 times, because .replace() iterate through the string in the background.
I think this code is much much, faster than the one liners, that are the top solutions for this kata, instead of going through each character in the string, it just does it for the whole string. Well done!
I love this solution
Interesting!
well using list comprehension is more efficient as it only iterate through the characters one time but in this solution it iterate through the character 10 times, because .replace() iterate through the string in the background.
short isn't always better. if you can do it with one loop, it'll be more efficient. so far, smart.
O(2n). Not the best one
if the look up times in this solution are constant then it looks good to me
I think this code is much much, faster than the one liners, that are the top solutions for this kata, instead of going through each character in the string, it just does it for the whole string. Well done!
No, it is not. Check in my other solutions. There is a faster one.
5572ms when I submit, test cases work fine
Strictly speaking, since there are only two unique values (guaranteed by the description), set will have len 2, thus O(1) memory consumption.
maybe i'm wrong, but expressions a+bc and cb+a not make sense, how do you think?
great answer, can anybody tell me what is the use of 24 there?
Almost same programm bro
"Regexp Basics"
you are missing the point
In description:
Loading more items...