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.
there is no need to change the original formula to solve the problem...
Added
Lua translation ! Can someone review it please ?Thanks !
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 thestrcmp
up.it works after using len of needle as sizean array instead of using malloc , but I wonder why , should be the same thing ;
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 :)
Please post your code following this: https://docs.codewars.com/training/troubleshooting#post-discourse
My bad, it looks like you were right there. Couldn't do this on the phone:
I used C
it's case insensitive , and there's a 'q' ,
Where do you see that second Q in the first string? Not a kata issue.
P.S.: shouldn't reply without being totally awake.
In what language? What is your code?
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 ;
Thank you for the changes and prompt reply!
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:
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.
Loading more items...