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.
This solution only fits on a single line but forces the array to be traversed twice.
This comment is hidden because it contains spoiler information about the solution
I found the solution, but my string is not really CSV lines with expected separator '\n'
In PHP I have this result :
Expected: '0,1,2,3,45\n10,11,12,13,14\n20,21,22,23,24\n30,31,32,33,34'
Actual : '0,1,2,3,45\n
10,11,12,13,14\n
20,21,22,23,24\n
30,31,32,33,34'
I just put '\n' in the end of line. But it's seems to bee not good
I don't understand.
I'm on PHP. In basic tests, when n strings = 6 and k = 6, my function returns '' and it is correct.
But in random tests, when n strings = 14 and k = 14, my function returns '' and it is asked for a string consisting of all the strings.
Idem for me (on PHP)
This comment is hidden because it contains spoiler information about the solution
I was tempted to use the array_map(), max() and min() functions but with this solution each array is scanned 3 times. Which doesn't pose a problem, we're fine with small arrays.
I guess it's clearer with pictures :)
This comment is hidden because it contains spoiler information about the solution
Thank you for your reply. And sorry for not specifying what language I'm using. :)
I try to understand in order to be able to program this Kata correctly but I confess to being lost.
The string "[(])" is not correct...?
While the string "[[(]])" is correct...?
The nesting of the braces is the same on the two strings, isn't it? I just doubled the number of [ and ]
And after reviewing my algorithm (after a little math lesson on how to determine a prime number), everything works fine.
Completed in 1303.11ms.
I will now see the solutions and see how this one can be improved.
And thank you again for the clarifications on the description (confusion between test number and largest test)
"And that's exactly what your code is doing. Not a kata issue."
No, I certainly misspoke but my code does not loop to determine if the number is prime or not.
The loop I'm talking about is a test that runs the is_prime() function X times (which was empty for my duration tests)
But thank you for enlightening me on the description.
I'm not English and didn't realize (reading the description) that there weren't 2^31 tests to perform but in fact the highest number tested could potentially be as large as 2^31.
I understand better and I'm getting back on my code, on my algorithm to improve it and that it can process a number as big as 9294972289 in less than 12 seconds :)
This comment is hidden because it contains spoiler information about the solution