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.
Very nice kata and very original. Is there a real life application, though? (python hobbyist, here, not an engineer)
As I understand it, it's just how BitConverter works. It seems that whatever architecture CodeWars uses to run our code happens to be little-endian, and thus GetBytes() acts accordingly. See the documentation:
The order of bytes in the array returned by the GetBytes method depends on whether the computer architecture is little-endian or big-endian.
Do note that the Kata does implicitly describe the first octet being the left-most one (and, correspondingly, the most significant one).
Definitelly to easy for 5kyu
Approved!
Python update (new testing framework)
WhAT Should i do when length < 30?
Heh :) somehow it slipped out of my view. It makes perfect sense now. Thank you for pointing that out!
but it's explained in the initial code:
Java has no
unsigned
, so you have to use along
to keep everything positiveEspecially in Java translation, it's confusing to see the method
String longToIP(long ip)
when the kata name clearly states that the IP address is represented as a 32-bit integer. From my point of view it would be more appropriate to haveString numToIP(int ip)
.My code passes all basic tests but this one where expected is 106.205.145.98 and my output is 213.155.34.98.
I found out when using .toString(2) on this particular case where the 32bit number is 1791856994 the 2bit number will have an extra 0 at the start.
I've no god damn idea what's wrong with this and why only this particular case.
Shouldn't .toString(2) be accurate?
Because input length maybe <32, we should convert binary to decimal started from end not from start. Maybe someone can say why, we should start from end?
i'm new to ruby can someone explain how does that %s work?
that remains seperately as a different problem with your code because it doesn't handle every case properly
But if it I don't allocate the memory, it causes a memory access error
In your code, you attempt to allocate memory for the provided
char *IPv4
within the function, but it has already been pre-allocated prior to being passed to the function.Loading more items...