Ad
  • Custom User Avatar

    But in O notation it will be 3x vs x² i think this is still better than having nested maps or foreach.

  • Custom User Avatar

    I think the issue is fixed, could you please verify?

  • Custom User Avatar

    It seems to be a bug, I'm not sure yet if it's a bug in the kata, or in setup of PHP on Codewars.

  • Custom User Avatar

    No, neither of those two is correct, and at least in PHP (you didn't mention the language), there is no test with "[[(]])" as input.

  • Custom User Avatar

    Please read the note:

    Looping all the way up to n, or n/2, will be too slow.

    And that's exactly what your code is doing. Not a kata issue.

    Kata is perfectly solvable in PHP:

    PHP Completions 2301

    And the highest tested value for PHP is 9294972289. It doesn't say there are 2^31 tests, it says for some languages there can be tests where n is near 2^31.

  • Custom User Avatar

    not an issue, PHP can be solved in 1 second.