Ad
  • Custom User Avatar

    Seems, your solution doesn't support float numbers

  • Default User Avatar

    Your code is running time is not more than 10 seconds, it shows that your code needs to be optimized^-^!

  • Custom User Avatar

    Can you help to check if something is wrong? I always get 'Code timed out' even my code passed a lot of tests ...

  • Default User Avatar

    OK thanks hencethus! I'll certainly keep that in mind for future katas

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Problem should say what the max primes are that it tests up to.

    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?

  • Custom User Avatar

    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.

  • Default User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    Sure, Kasare12. How may I see your code to check it?

  • Default User Avatar

    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

  • Custom User Avatar

    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

  • Custom User Avatar

    Best solution so far ;)

  • Custom User Avatar

    Agree with rayning that the max value constraints should be added.

  • Custom User Avatar

    Very nice solution! Double tilde can be used as Math.floor if the value is positive ;)

  • Loading more items...