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.
It might be the same, but the description in the kata is hard to understand. What ezeuzo1 wrote made complete sense and made the kata super easy to complete.
Given a list of the characters "R", "G", and "B", determine the least number of characters you must remove in order to make a list in which no two neighboring characters are the same. Hope this helps.
This Kata uses Node version 8.1.3 which doesn't support trimEnd, try trimRight instead :)
It's the same:
If the passed in function returns true for none of the array elements, then your function returns true
If the passed in function returns true for any of the array elements, then your function returns false
We can't read your mind, please, post your code so we can check it. Mark your post as having spoiler content too.
Should be fixed now, have a look.
thank you very much zer0gravty, this should be the official explanation of this kata
https://www.dotnetperls.com/console
just print the input to the console
Help us help you. Tell us which language you're having these problems with.
Closing.
Good explanation, the instructions was prety confusing,thanks man.
I had the same problem. I unlocked the solution and realized that the description does not say, that input numbers may not be Integer :-/
And the numbers are separated with '.'
It should be in the description because this is not the only way to represent floating point numbers (comma as a separator could also be valid)
If you're timing out it's likely you're hitting an infinite loop somewhere. No matter the approach, this kata isn't computationally heavy.
Define two functions. The first is probably the easier, since you are dealing with plaintext. The first parameter (i.e. encrypt(this_is_the_first_parameter, second_parameter) will be some sort of message you want to encrypt... i.e. the secret location of all your buried gold. Let's say your message is "In the basement." The goal of your encryption function is to take every other letter, and make a secret message out of it, starting with the second letter. So, using our plaintext message, we would start with 'n', then the next letter would be 't' (remember -- the computer thinks SPACES are characters, too, so they will count as a letter), then the third letter will be 'e'... and you're going to do this until you have used every letter in the original string (so your cyphertext will match the length of your plaintext.) Naturally, you need to start back at the beginning of your plaintext, once you reach the end the first time around... i.e. the word "Sonar" becomes "oaSnr" because if you only use every other letter one time through, you'll have "oa" as an answer and that won't be correct, and will be impossible to decypher the secret message.
If we did this one time, the argument to our second parameter being one (don't type 'one', use the number), our secret message ("In the basement.") will become ("ntebsmn.I h aeet"). Now, that was only one time through. You need to repeat that process on the text for n times. Let's say, that instead of n only being 1 (one-time through), it was 2.
SO now, instead of taking the original text of ("In the basement."), you're going to do it to the cyphertext after having done it one time.
i.e. ("ntebsmn.I h aeet") will become ("tbm. etnesnIhae"). Keep doing that until you've done it n times.
Then, write a function to decrypt it! (NOTE: your decrypt function should be the same n --> this is what's known as your key in cryptography. Basically, if somebody encoded a message using a key of 4, you could only decode it with a key of 4. Otherwise, you won't get the original message, even if your using the same algorithm and function.)
encrypt("In the basement.", 2) --> "ntebsmn.I h aeet"
decrypt("ntebsmn.I h aeet", 2) --> "In the basement."
The tests in JS, CoffeeScript, and Ruby have been updated to use assertEquals / assert_equals in the last week.
Loading more items...