Ad
  • Default User Avatar

    This solution only fits on a single line but forces the array to be traversed twice.

  • Default User Avatar

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

  • Default User Avatar

    I found the solution, but my string is not really CSV lines with expected separator '\n'

  • Default User Avatar

    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

  • Default User Avatar

    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.

  • Default User Avatar
  • Default User Avatar

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

  • Default User Avatar

    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.

  • Default User Avatar

    I guess it's clearer with pictures :)

  • Default User Avatar

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

  • Default User Avatar

    Thank you for your reply. And sorry for not specifying what language I'm using. :)

  • Default User Avatar

    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 ]

  • Default User Avatar

    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)

  • Default User Avatar

    "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 :)

  • Default User Avatar

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