Ad
  • Custom User Avatar

    look at the basic operator types, if you did what I did you probably have type issues instead of rounding issues. i.e. look at integer division instead of the division operator that returns a float.

  • Custom User Avatar

    Looks fine to me now?

  • Custom User Avatar
    @simonvpe:
    It makes heavy use of the cache and the complexity is O(1) in best case, and O(n) in case there are only nested "bogus" sequences like [[<>]].

    Do you mean, O(n) iterations through the source_code string? That gives you O(n2).

    UPD. My bad, I've got your idea just now. It seems to be optimal enough, but there may be small hateful bug, which makes you suffer.

    P.S. Finally there is one solution (except mine), so I believe that kata is solvable.

  • Custom User Avatar

    It takes at most 2 seconds to test my solution (I've tested it right now - it took 1364ms).

    If you cannot pass the performance tests section, probably your code isn't optimal enough. What is time complexity of your solution?
    Also, big output may be caused by the error in the solution. 'DoTest' function tries to output actual and expected results, which can be quite large.

  • Custom User Avatar

    I have the same problem.

    The example tests are ok, but the complete tests can never be done. It seems the problem with the performance of the tests (too big, too much for the codewars resources).

  • Custom User Avatar

    Not only C++, the descriptions for all languages are currently broken.

  • Custom User Avatar

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

  • Custom User Avatar

    Haha... It was the first thing that came to mind, wasn't expecting people to read my code...

  • Custom User Avatar

    @simonvpe : never post your code without the spoiler flag activated. ;)
    (I flagged it)

  • Custom User Avatar

    Please feel free if you are so inclined. I'm always interested in performance comparisons and learning a bit more about optimization.

  • Custom User Avatar

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