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.
Yeah, it has been a while since I made this, looking back at it right now and I'm not very happy with the way the code turned out. The code is interesting, show some cool tricks, but it is not a good answer.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
"res" is in the stack, you cannot return it because at some point - after the return of the function - this memory will be released.
Yes, actually we have a problem right here. Just checked and std::string does not terminates in NULL, I thought that was the case.
Yes, actually we have a problem right here. Just checked and std::string does not terminates in NULL, I thought that was the case.
Well, I guess I failed the english test.
Thank you for your patience.
I am doing this kata in C and found the same issue reported in GO lang (not really the same, but very similar and in the same test case):
{
char* a1[] = {"it", "wkppv", "ixoyx", "3452", "zzzzzzzzzzzz"};
dotest(a1, 5, 3, "ixoyx3452zzzzzzzzzzzz");
}
Error. Expected ixoyx3452zzzzzzzzzzzz but got wkppvixoyxzzzzzzzzzzzz
I am doing this kata in C and found an issue in the same test:
{
char* a1[] = {"it", "wkppv", "ixoyx", "3452", "zzzzzzzzzzzz"};
dotest(a1, 5, 3, "ixoyx3452zzzzzzzzzzzz");
}
Error. Expected ixoyx3452zzzzzzzzzzzz but got wkppvixoyxzzzzzzzzzzzz
This comment is hidden because it contains spoiler information about the solution
First of all, nice kata! I've learnt so much with it.
But there is a problem with the tests. I can submit my code even though I just implemented the first function! The ToInt has the no return statement, and it is passing in the test the same.
What I did:
*Changed from class to namespace
*Implemented first function correctly
*left the second function empty
int ToInt(std::string s)
{
}
*Passed the tests!
I tried to solve it without using regex. Most of the solutions using regex are 5~10 times slower.
I really do not like exceeding 80 character per line.
Made some minor changes, I find this solution very elegant.
I find this kind of code very hard to understand/mantain. Too many conditions, too many loops and too few comments. This would never pass my code review.
Loading more items...