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.
This comment is hidden because it contains spoiler information about the solution
Please approve, it is fine !
The thing is that the width specifiers don't dictate the particular argument length, but only maximum.
So the string with exact same length can have value that doesn't fit the pattern but will be accepted if we remove this check.
it is used to catch any extra trailing characters, then sscanf would return 8, and not 7, therefore when it returns exactly 7 we are sure that we don't have any trailing characters.
In this exact case std::begin() will just call vector.begin(), so no difference really, only that std::begin() is more generic function.
This comment is hidden because it contains spoiler information about the solution
Fixed
Initially it worked in codewars and in my local environment because they both were using 64 bit compilers, and from what I've read the unsigned long is 8 bytes in 64 bit compilers, and 4 bytes in 32 bit compilers. I think ther may be some other cases but in general this was the reason.
P.S. Republished with unsigned long long
Thank you for your feedback.
Do you have any suggestions on how to fix it wuthout breaking solutions ?
Yes, you are right, initially I should have used unsigned long long instead. It is a mistake.
Hello. Why would you ever return a pointer to local variable as an answer ? This is potential segfault.
Hello. Why would you ever return a pointer to local variable as an answer ? This is potential segfault.
Hello. Why would you ever return a pointer to local variable as an answer ? This is potential segfault.
Hello. Thanks for your points, I reviewed and made a new fork (my existing translation was not editable).
Hello. Thanks for your points, I reviewed and made a new fork (my existing translation was not editable).
Loading more items...