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.
Genius
nice, But I wonder if there will be any duplicate letters?
nice
Nice work putting the "set" inside the regex :)
i hate Regexp, but is very friendly in cases like this
I dont even know what I am looking at
this is literally when maths in high school suddenly includes letters lmfao
Scroll down the comments to one that was made about 6 years ago. I've replied with a detailed explanation that should help you understand.
Use regex101.com for analyzing regular expressions.
I did string.match(/[a-z]/g) but it return just amount of letter this string contains(not amount of unique letters), why it wasnt working? Can anyone explain please
That's a very clever solution! Although, I think it's running in O(n^2) right?
nice! knew that regex would be the shortest way but was looking for a one liner and here I am !
It's more so that it's matching the last instance of the thing you are looking for. Because, for instance, it won't match x if there is another x later on in the string, regardless of the characters in between. That's what (?!.*\1) is doing here - it's making sure that a match is not made when there is another x later on. In the context of this kata, then you can see it's actually helping us find only the last instance of each unique alphabet character.
Was wondering the same thing, thaks for asking. I added it a 'break' after every case for best practices but wasn't sure if I needed it.
does this regex mean that it matches any character? And when it finds a match it ignores all other matches in the string?
I tried running it in RegExr, and I got confused why it ignored "The" at the beginning of the string but matched 'the' elsewhere.
This is the Best Practice!
Loading more items...