Ad
  • Custom User Avatar

    It would make more sense to use an assoc list for the towns argument just like it is for the distances arg. Also maybe drop arrays altogether and use lists

  • Default User Avatar
  • Custom User Avatar

    The translation to ocaml is really not very good...

  • Custom User Avatar

    k seems to be a single digit number, and n is only up to a few million (7 digits) long (Python version), so if you're getting timeouts, you should reconsider your approach.

  • Default User Avatar

    I don't think of how much k can be, bc idk the max values for n or p, so the code freezes on codewars for veeery big iterations of k

  • Custom User Avatar

    Could you provide an example at least? Did you read that once reversed they should be a different number? So 11 is not a valid result, neither 2, 3, 5 nor 7. If you're sure there is the problem with the tests, provide your code and the language you're working on, the problem may exist only in that one.

  • Custom User Avatar

    There is a problem with tests, as they don't include all correct results in the resulting list. I get more values and those additional ones also correct, so there is something wrong with tests and answers. Please fix

  • Custom User Avatar

    The expected value for that test is this one: 1:ooo/1:uuu/2:sss/=:nnn/1:ii/2:aa/2:dd/2:ee/=:gg"

  • Custom User Avatar

    Seems like this kata has issues in test in js part

    //2nd case
    expected '1:ooo/1:uuu/2:sss/=:nnn/1:ii/2:aa/2:dd/2:ee/=:gg' to equal '1:ooo/2:sss/1:uuu/=:nnn/1:ii/2:aa/2:dd/2:ee/=:gg'
    

    The description says:

    when they have the same length sorted in ascending lexicographic order (letters and digits - more precisely sorted by codepoint)
    

    I assume they must be ordered based on full substring (like i need to compare 1:uuu with 2:sss for example), but in that case 2:sss/1:uuu part of the test assertion breaks the rule.
    Same problem if the substrings must be sorted based on corresponding character (like u and s) - then the 1:ii/2:aa part breaks the rule.

    There are three possible reasons - description is incorrect, tests are incorrect, or i'm really dumb

    If you guys know how exactly it should be sorted, please tell me...

  • Default User Avatar

    Nice and simple but inefficient the bigger the number gets since you need to compare every single value till that number.

  • Custom User Avatar

    I cant understand the question at all

  • Custom User Avatar

    In case this is a question you forgot to null-terminate your result string.

    Edit: Just saw the next post.

  • Custom User Avatar

    Count the appearances of the digit d in the squares of all numbers from 0 to n.

  • Default User Avatar

    I tried it both ways. If I return 0s I get more errors in random tests. If I return "" I get less errors. But still get errors

  • Default User Avatar

    There's a very poor description of the condition in the kata!!!
    I'll add a condition that will help you solve the problem.
    You need to check that it does not return null variants.
    For example, you have stock_list([[“ABART 20”, “CDXEF 50”, “DKWRK 25”, “BTSQZ 89”, “DRTYM 60”], [“W”, “H”]))

    Your program will return the value "(W : 0) - (H : 0)", but since all values here are NULL, the program MUST RETURN an empty string ""

  • Loading more items...