Ad
  • Custom User Avatar

    Description copied from kata; added typescript codeblocks.

  • Custom User Avatar

    yeah, python IS fucking slow compared to JS. You need to keep the general structure, then find the input caractéristics that makes the tests perform the same in python (durations), checking that the O(n²) solution still times out by a fair amount.
    Better to have a bit less tests with bigger inputs than the opposite, generally.

  • Custom User Avatar

    Make the tests smaller, if python is too slow :)

  • Custom User Avatar

    you're lucky I saw your message on the dashboard... (mentionning an user does not work on CW)

    well, first things first:

    • fix typos
    • fix the use of the test framework (you're using the old syntax) => https://docs.codewars.com/languages/python/authoring/
    • fix the random generator
    • do more ""smaller"" tests, yes (keeping the perf aspects, but see FArekkusu's issue) => somehting like 50 short random, and like 50-100 tests with longer inputs for performances, adapting the length of the strings so that O(n²) dies horribly already, but O(n) passes in like 5s
    • personnal opinion: I really don't like to have an empty input when no parentheses. By applying the logic of the problem, the output should be an array with the full input as only element.

    For example.