Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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?
This comment is hidden because it contains spoiler information about the solution
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.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 returnfalse
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 betrue
.I haven't seen the tests but it seems that a test case is duplicate but with different expected results...
Please, can someone confirm?
Lua translation!
Groovy: initial solution is missing import:
import java.util.function.DoubleUnaryOperator;
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?
method name removNb seemed unnecessary, any reason you didn't name it something clearer like removeNumbers?
Groovy Translation
I think that whoever coded the random tests for Perl made a mistake. I get the following test failures occasionally:
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!
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?
C version doesn't need an additional argument n, numbers in string can be easily counted.
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.
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.
Groovy Translation
Loading more items...