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.
Really clean solution. Nice work. Agree you probably don't need the cache.
And technically that is more accurate because parseInt can cause some issues at very large or very small values.
To anyone seeing this comment.
Memoization will be helpful to make the code run without exploding. BUT, it will not solve the computation. You still need to figure out how to compute it :)
I'd still agree with headliner.
Several subproblems requiring multiple functions and transformations (whether labeled or anonymous) is probably a 5+. This was definitely more time & brain consuming than any 5 I've done so far.
Not sure if I just don't know how Codewars works, but looks like you have no solution to show.
Would be happy to take a look. Mine isn't as elegant as the top 2 answers (I didn't use Object classes or anything), but I think I've got my head wrapped around some good ways to do this kata.
It's definitely more challenging & time consuming than any other <6 Kyu> I've done before. Several sub problems to solve.
Same for the JS tests, ran it multiple times without issues.
Thankfully no one seems to have distilled it down that short 😂.
This is a genuinely long problem. Some very good and varied solutions to it. Lots of fun little sub problems to break down.
Well I certainly over complicated this.
Who would have thought to hardcode the odd digits.... LOL.
This comment is hidden because it contains spoiler information about the solution
@Nolonar - comments are available to read before completing the solution.
Some people look to them for clarification or clues if they're stuck on a problem.
@Nolonar - comments are available to read before completing the solution.
Some people look to them for clarification or clues if they're stuck on a problem.
@Nolonar - comments are available to read before completing the solution.
Some people look to them for clarification or clues if they're stuck on a problem.
@Nolonar - comments are available to read before completing the solution.
Some people look to them for clarification or clues if they're stuck on a problem.
@Nolonar - comments are available to read before completing the solution.
Some people look to them for clarification or clues if they're stuck on a problem.
In the defense of this solution - the virtue of ROT13 is that it is its own inverse. That is, if you put the return value back into the same function, you will return the original input.
This is ONLY possible with a shift of 13 in the english alphabet.
So there really is no reason to abstract away from 13 and hardcoding the replacement array is actually the most efficient, readbale, and sustainable solution.
I wouldn't be surprised if most real-world applications of ROT13 do it this way.
Loading more items...