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.
Seems, your solution doesn't support float numbers
Your code is running time is not more than 10 seconds, it shows that your code needs to be optimized^-^!
Can you help to check if something is wrong? I always get 'Code timed out' even my code passed a lot of tests ...
OK thanks hencethus! I'll certainly keep that in mind for future katas
This comment is hidden because it contains spoiler information about the solution
Rayning and anhkind, for some reason I can't use the 'reply' function. Most of the solutions posted so far don't hard-code in an upper bound. Even one sieve solution generates an upper bound using the prime number theorem.
Why do you think it should be specified ahead of time?
I'm rayning3 on Skype, if you want to talk. If you have any questions about Ruby, I've been programming in it for over 1 year now. My email is rayning@gmail.com. I'm happy to help! What's your new job? Congratulations.
Ok thanks rayning for clearing that up with me. I'm very green to Ruby so I'm still trying to get a grasp on how things work with the language (Learning it for my new job I recently was hired to). I wasn't aware gems were foul game as I just recently learned about them (job uses many of them) but I definitely understand where you were getting at. The question itself didn't say anything about not being able to use them but I will keep that in mind for the future. Thanks again! I will try to come up with another solution
C'mon, Kasare12. You shouldn't use a gem (someone else's code) to make primes. Figure out an algorithm to create your own. If you are using a gem, you can't modify the code internally. Also, this problem goes up to a big number, on purpose. The basic brute force way of finding primes won't work. You need to find a faster, more efficient way. Project Euler (https://projecteuler.net/) does the same thing. They always ask you to find something that may be simple if done for a small case. But then you must solve it for a 100 digit number (or more). Brute force usually won't work.
Sure, Kasare12. How may I see your code to check it?
I think I have found a correct solution for this kata. It works in irb but doesn't work when I try to run it on here...Was wondering if there was someone that could verify my code to point out something I'm overlooking
This is good, but the conversion to arrays imparts some overhead.
I made a JSPerf to test different solutions:
http://jsperf.com/codewars-sum-strings
Best solution so far ;)
Agree with rayning that the max value constraints should be added.
Very nice solution! Double tilde can be used as Math.floor if the value is positive ;)
Loading more items...