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 is very sexy
In other words you point
p
to the value ofx
as an address (it's not forbidden to do it until you do use this address)And then using the index operation you get the new address added by the value of
y
and because the size ofchar
is one you got exactly what you need...Great!
But under the hood the forbidden addition is still used...
So it's a hack...
(cool)
Can you explain this to me? I have no idea how you are doing it.
It uses pointer arthmatic.
When you have pointer p.
&p[n] is just equal to p + n*sizeof(p[0]).
p is pointer to char, so sizeof(p[0]) is 1
There is an even shorter solution :D
How does this one work? I don't understand it.
That's too bad. :(
btw, should 1, return 0 since |1-0|<|1-4|?
Ruby solver function is very inefficient, so it's impossible to complete. See:
https://i.imgur.com/eTx828F.png
Once again, I suggest to use ZED.CWT's solution (both in python and ruby) for the solver function.
Hi Etothetaui. I'm not doing translations into C right now. This kata has a version in ruby and I got ready a javascript version that will be released in some days.
Hi raul,
should 1, return 0 since |1-0|<|1-4|?
Also can you submit this for C? I think I have a solution written in C that I would like to submit, since I don't know Python.
If I can help make a version of this kata for C let me know. I don't really know how.