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.
ahahaha
Could you mark up that code with line breaks?
(See Documentations -> Codewars Platform -> Comment Markdown, and click through from there.)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I tried integer array, and though it is a bit faster, it is still times out all the time.
Doing away with the splitting and the mapping did not help for the string solution either.
Going for the lookup table approach next time.
I really enjoyed this kata. Got a lot of fun solving this. I finally got the opportunity to submit my solution after trying it a few times. The efficiency might not be the best.
I think string lengths grow exponentially, and they just get out of hand a bit for
n>50
. Withn<=50
the tests run my solution between 4 and 5 seconds. Splitting and mapping arrays of millions of elements is going to take time. But doing any work on an array that size is going to take time.I was lucky to be able to submit I guess.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This kata is really simple fun, lol