Ad
  • Default User Avatar

    Lua translation ! Can someone review it please ?Thanks !

  • Custom User Avatar

    Now you have buffer overflow in your solution.

    Also your malloc and the stack-based array are not the same. The thing you malloced was not properly null-terminated (even though it had a null-terminator at the end) and contained trash which tripped the strcmp up.

  • Default User Avatar

    it works after using len of needle as sizean array instead of using malloc , but I wonder why , should be the same thing ;

  • Custom User Avatar

    Your solution is buggy in more than one way. The things you pass to strcmp are incorrect.

    You also do not free the malloced memory.
    And why even malloc any memory, this problem can be solved with no additional buffers :)

  • Custom User Avatar
  • Custom User Avatar

    My bad, it looks like you were right there. Couldn't do this on the phone:

    "jQoDqHaPXXYcTnORAxBbZRmNK" , 
    "JQo Q apXx C n r XbBZ M k"
    
  • Default User Avatar
  • Default User Avatar

    it's case insensitive , and there's a 'q' ,

  • Custom User Avatar

    Where do you see that second Q in the first string? Not a kata issue.

    P.S.: shouldn't reply without being totally awake.

  • Custom User Avatar

    In what language? What is your code?

  • Default User Avatar

    random test dont verify well ,
    ("jQoDqHaPXXYcTnORAxBbZRmNK" , "JQoQapXxCnrXbBZMk") should be true , I test the program in my local ide and got true , but in the random test I got false ;

  • Default User Avatar

    Thank you for the changes and prompt reply!

  • Custom User Avatar

    I changed the tests to give a somewhat bettwer feedback, but infortunately your solution fails only for longer inputs so it can be not that easy to debug. However, I found out that your solution fails following test case:

    assert.strictEqual(nameInStr('Betty', 'Betty'), true);
    

    Additionally, you are handling letter case incorrectly: "case-insensitive" means that lowercase letters and uppercase letters should be treated as the same.

    Yoru solution is buggy, it's not a kata issue.

  • Default User Avatar

    From Output:

    Expected: true, instead got: false

    Log

    [ 'ocll tottcnydlj yxp yajneqiybj axeeberr y kyttidbirsiyem hmjjlrijr jalci ii ts r',
    'Alexandria' ]


    Sorry, I don't understand why we should end up with "true".

    "Letter comparison should be case-INsensitive."

    And there is no "A" in the "str".

    And even if we forget about letter case, the letters are not in the right order:

    'ocll tottcnydlj yxp yAjneqiybj axeeberr y kyttidbirsiyem hmjjLrijr jalci ii ts r'

  • Custom User Avatar

    Formula in the task's description is correct. It becomes incorrect if you place parentheses in wrong places.

  • Loading more items...