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.
Definitely clever, not sure why people tend to vote best practices on solutions that are nearing code golf level of cleverness though. If most people were straight up handed this code at their job, it'd take them a while to even figure out what it does, let alone work with it.
That was an excellent Kata.
Piece of advice for everybody working on it: Read the description and think about what you know about the problem.
Don't be like me, going down a rabbit hole of memoization, optimal factorization algorithms, and obscure code features, only to finally sit down and read the description carefully.
This problem doesn't require any of that.
I will make note for Ruby ;)
Earlier katas stated whether your function was expected to be pure, or whether the author actually copied the arguments beforehand. So @Hybr1d, you probably want to add this to the description. although this only effects Ruby (AFAIK).
That immediately solved it, thanks bkaes. I totally forgot about the hoops you have to go through to "copy" an object in Ruby.
Changing it to dna.dup fixed it.
Perhaps just constructing a new string would be better?
t
isn't a copy, but actually references the very same object asdna
. See http://patshaughnessy.net/2012/1/18/seeing-double-how-ruby-shares-string-values for another example.Try not to manipulate given String because test ares testing the opposite then. Since you manipulted it :). Create new String and return that.
PS: If you still have trouble look online if not enoguh then just pass solution and you will see what you did wrong ;)
This comment is hidden because it contains spoiler information about the solution
Oh... don't change the actual input create new string and add to it :). Then it works... like bkeas told you
Has the same problem whether I manipulate the input or not, going to post a screenshot.
Does your solution manipulate the argument? Your function needs to be pure, e.g. it may have no side-effects on the argument or the environment. As far as I can see, you change
dna
inplace, therefore invalidating the argument used for the verification.This comment is hidden because it contains spoiler information about the solution
To be honest I have no idea why...But test work for me just fine post solutin here I will mark it as a spoiler...
Input: GGGTTTTCTTTCACC
Expected: "GGGTTTTCTTTCACC", instead got: "CCCAAAAGAAAGTGG"
The random tests are expecting the output to be the same as the input.
Tell me what is wrong, the test seems fine for me?
Loading more items...