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.
Thanks for clarification, knowing that I am expected to round only the final results and not the partial results will definitely assist me in debugging. I'll try to handle this myself first, thank you for your assistance!
It varies because I have several solutions.
Generally speaking I rounded it with several different methods, and at different levels - i.e. in one test I've only rounded the final result, in other tests I've rounded all the multiplied values, in yet another I've rounded only some of them.
The higher the precision* I've kept, the bigger the gaps were. I've received the "consistently closest values" (i.e. difference of 0.05 not 0.5) by doing the "appropriation" and not even the roudning by using the following imprecise formula: Math.round(value * 1000d) / 1000d;
I've verified some of the results manually and for the method that I've thought should give the highest precision I've had same results as on Google's and Microsoft's calculators. If I am wrong, please hint me the right method of how is rounding done in Java.
*"precision" is pretty relative as I am definitely not an expert it this field
I've tried doing this in Java but I fail on random tests.
I've searched for most precise methods of doing this and avoided common imprecise rounding methods.
I've analysed the values and calculated the areas by hand and I stand with the results my code produces.
Could you please take a look at the Java TC's translation?
How do you Google for "~" ? :(
Woah, no lambda, I am amazed. I gotta research the ~- thing.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Interesting Kata. I'll come back to it, and I think to CW alltogether, once I'll solve the challanges on project Euler - often I found myself stuck because my approach to given tasks are too brute-force. In the job I do, its not a problem, but in the jobs I'd want to do, it is.
Thanks for the direction.
Surprisingly satisfying Kata.
Also, regarding the random input generators, as of 2nd of July 2017, its pretty specified that you can only use one_two() inside one_two_three()
As for doing the above, indeed I did, as for keeping this simple, well, my sight is far from being perfect, but I'd probably see room for improvements in that matter even if I were semi-blind ;)
@Volie:
Since the Kata itself is not really about checking if number is a prime or not, but about optimization of the process, it seems reasonable to rank it past the threshold of "able to get it done", and put it in "able to get it done quickly" basket.
Anyway, CodeWars have tied in my personal ranking of best websites ever, and I thought that Quora is unmatched when it comes to getting rid of your own ignorance. It's not the first time you're responding on my concerns in the discussions, thank you for caring for this environment!
@GiacomoSorbi:
Thanks for the input, you know, from the perspective of beginner programmer, a program which finds first 1000 prime numbers in 0.5 seconds seems efficient. Now I understand why it is not, and have gone much further in the Kata - to the point that I never get any errors from failed test cases. Unfortunately, there is still room for optimization, as I exceed the 12s threshold on checking whether numbers of size unknown to me are prime. For bilions it works fine. Could I please ask for the biggest possible value available in the Kata test cases, so I could analyse the performance on my local environment?
I have wrote a solution, and it worked. I'm a noob, so I was sure there's a better way for that.
I then thought "ok, so there's this try/except stuff, which I do not yet understand, and which could make my solution shorter".
Thanks to this Kata, I have finally found a case in which I knew what I expected the code to do, and this is my first successful usage of try/except mechanism. I learned something new, and I have stripped my solution from 15 lines of code.
Thanks for the Kata.
This comment is hidden because it contains spoiler information about the solution
okay, so now I've read all the discussions here, have read the ecolbans comments, know what to do and going further with the Kata seems probable - instead of completely failing the tests, I now have too big discrepency between the number of primes in the list (i.e. 168 where there should be 152).
Anyway, I think I'll manage, and actually I've learned so much even before completing the Kata.
The only concern I now have is the difficulty level of this Kata. It's marked as 5, its harder than those of Kyu3 which I have managed to pass, its definitely closer to kyu3 than to kyu5.
Loading more items...