Ad
  • Default User Avatar

    I am somewhat new to codewars, so maybe this feature is available and I'm just not aware of it. I like the ability to observe other peoples implementation; it's good for education in various clever approaches to problem solving, and idiocyncracies of a language. I noticed that the small and full test suite show run time. hmm... what about comparing various implementations using Benchmark to rank efficiency of a solution? So I did that using mine and 5 other solutions, then started refining mine with lessons learned from the benchmarking. Some things that work for a single method testing (altering default input array) become problems when testing multiple methods. Some techniques (smartmatching), while valid for the language, are just slower when compared to "less clever" techniques (simple for loop). Is there a good place in codewars to post my code and findings? Do other languages have something like the Perl Benchmark module for time testing, stress testing?

  • Custom User Avatar

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

  • Default User Avatar

    My bash script works, but it is not efficient enough to finish within 12000 ms. I made my best attempt at translating my completed Python solution to bash, but unfortunately, the bash version is too slow. Any suggestions for improving efficiency in bash? I am using associative arrays to convert between letters and their decimal equivalent. Is there a better/faster way to do that in bash? Also I am using bc to handle most mathematical calculations.

  • Custom User Avatar

    I think that there must be some issues in GO (golang) tests.

    I belive I've the solution. The only doubt I've is when both arrays are empty. For the moment, I'm presume the result should be true in this case.

    My solution passes all the initial tests, all the random tests and many of the "basic tests", but one of them is failing.

    I've placed logs to see where my solution was failing and it's when both arrays are empty (It was expected to be false). So, I changed the condition to return false in this case and the new solution still fails and still does when both array are empty, but now, it seems to be expecting the result to be true.

    I haven't seen the tests but it seems that a test case is duplicate but with different expected results...

    Please, can someone confirm?

  • Default User Avatar
  • Custom User Avatar

    Groovy: initial solution is missing import: import java.util.function.DoubleUnaryOperator;

  • Custom User Avatar

    I'm not sure that the label “fundamental” should be attached to this kata. Isn't this type of algorithm specifically linked to a particular field? So it's not fundamental in general, is it?

  • Default User Avatar

    method name removNb seemed unnecessary, any reason you didn't name it something clearer like removeNumbers?

  • Custom User Avatar
  • Default User Avatar

    I think that whoever coded the random tests for Perl made a mistake. I get the following test failures occasionally:

    dec_2_fact_string(92351059480)
    Test Failed
    got: '10A964666212200'
    expected: 'EA964666212200'

    But the expected answer is clearly wrong, as the Nth rightmost digit in the number must always be below N by definition. The last digit can only be 0, the second-last can only be 0 or 1 and so on. And if the factorial-base number has 14 digits, it can't have the digit "E" anywhere, since it represents 14!

  • Default User Avatar

    i have solved the problem(i think) but my code is not efficient and its always time out. in my IDE code takes only 0.078 secs but here it's taking more than 12000ms. i can't understand. also used AI for this optimization but no use, any ideas?

  • Custom User Avatar

    C version doesn't need an additional argument n, numbers in string can be easily counted.

  • Custom User Avatar

    Pascal. Found ambiguous situation when factnums 108385155241100 and E8385155241100 are decoded to same 91160968664 dec. My solution passed to submit from time to time. Please update the description about ambiguous decoding and add this case to Fixed tests.

  • Custom User Avatar

    OCaml tests don't catch all errors. My solution breaks for smaller strings, where it doesn't append empties to make the list length 5. Neither does it break the strings according to the rules.

  • Custom User Avatar
  • Loading more items...