Ad
  • Default User Avatar

    The same issue :/
    text = "7rc4F3z1QVNWp9CN", duplicateCount(text) should equal 3. 2 is not equal to 3.

    Expected:3
    Actual:2

    Where is the third?

  • Default User Avatar
  • Custom User Avatar

    approved with fix.

  • Custom User Avatar
    • Updated Rust version
    • Fixed sample test name
    • Added assertion messages
    • Improved random tests
    • Changed input and output types from i32 to u32
  • Custom User Avatar
  • Default User Avatar

    The same trouble.

    "j6X2uPtwNluGqqVyAGVURCSwWBZHkWaIxzsamyEf2N4xjBMvo5I7icrVZpeRX5jqqrheXo4u6Gym7NSUkja0G" - expected 25, my result 27
    "k0D9FXVzR9Pua6RXoM9yRFc4osh0MQWNVOrxoQwXdlqkntbYmopB7utSm7FcPY3QtGthJN2gI" - expected 22, my resul 23
    "kwNYz9JLtOiFcEmHiINTKoOFHhbbDKnddG4Lqu09c2koyMoGbkbbhnXEMLKAxr9Sk" - expected 18, my result 17

  • Custom User Avatar

    Fixed. Thanks for reporting.

  • Custom User Avatar
  • Custom User Avatar

    I keep doing the same thing if the first thing I would do would be to make an exact copy. The thing is the argument passed by value is just your local copy and you can do whathever you want with it without having it an effect for the caller. For the caller it matters little whether you take const & and do a copy explicitly or take argument by value. No changes are visible outside of a function.

  • Custom User Avatar

    On x86_64 Linux (this case I presume) size_t is usually typedef for unsigned long. So sizeof(size_t) will be 8 and sizeof(int) will be 4. With size_t you need store how big something is in memory, so it's unlikely be shorter than int anywhere, but it's still wasting memory. At least half of that diffArr array is always empty. That cast from malloc is not needed in C either as (void *) is implicitly converted to any kind of pointer (Unlike in C++).

  • Custom User Avatar

    Thanks for the Kata! It brings back memories. I haven't seen Pascal for like 18 years. :-)

  • Default User Avatar

    i have the same issue.

    in the ide of codewars, my code identifies n-1 duplicates in the string
    whereas I ve compiled it with the random case string in a .c on my terminal and the same code identifies n duplicates (as would be needed to pass the last random case).
    I m quite uneducated in the matter, my 2cents would be a compiler finesse.
    I ll keep learning.

  • Default User Avatar

    Yes, you're right. Fixed it.

  • Custom User Avatar

    I'm absolutely unable to pass random tests for D. It tells me for example:

    Because text = "hHk7HB1sv1Bzh4tSDrwCvyqfJNvDPgdJ", duplicateCount(text) should equal 6. 7 is not equal to 6.
    

    But no matter how am I counting I'm unable to find a mistake. I'm looking for duplicate case-insensitive alphanumeric characters. What am I missing?

      1 1 1
      2 B B
      3 d D D
      4 h h H H
      5 J J
      6 s S
      7 v v v
    
    hHk7HB1sv1Bzh4tSDrwCvyqfJNvDPgdJ
    ^^  ^^^^^^^ ^  ^^   ^   ^ ^^  ^^  
    44  4216712 4  63   7   5 73  35  
    
  • Custom User Avatar

    When it comes to D version, it seems to me, that the sample tests are missing two imports import solution : findShort; and import std.string : format;. Main tests are fine.

  • Loading more items...