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.
Lol I'm the same way. I enjoy seeing these one line solutions, though, because it helps me learn how to write more efficient code
""
) when there are no letters in the input. the tests expect a heap-allocated string, so they will crash when they try tofree()
the string literalstrcat()
andstrncat()
on unitialized memory. these functions look for a null byte to start writing; the memory returned bymalloc()
is NOT 0-initialized; neither are local (stack) variables likestr_num
, unless you explicitely initialize them withchar str_num[4] = {0}
.str(n)cat()
will keep scanning the memory until it finds a 0 byte, so your program is unpredictableI have spent hours upon hours on this and the kata says it's getting invalid memory address, while on my own compiler it works completely fine. I'm really pissed off, none of this makes sense
It's very simple, although it contains a magic number which isn't great practice unless if it's self-explanatory. The 3 here is self-explanatory but the 2 is not. Things like this should be labeled with a comment or set as a variable.
imo well it depends on the situation actually but unfortunately i think it is difficult to actually return a literal with a zero in front since some languages like python prohibit base 10 integers with leading zeros
ofc its nice to remember that for example an int literal is 32 bits long in java and that there are leading zeros there but i think for the sake of this exercise it is better to have the ints without leading ints
"Make it green, than make it clean" I feel like is a reference from Undertale
I think it's not necessary for 0201 to be 201
How are we suppose to modify a paramater when it's a constant
what why
I'll agree with this, I believe the author needs to give a much better explanation
I kind of forget to do simple logic like this, I just like using for loops similar to how majority of C is operated