look more carefuly at the description : it mentions the method getNext() to get the next node. So, in order to get the next node, you can do node = node.getNext().
the node object is given as an argument, and is an instance of a custom class defined somewhere else.
As the challenge require you don't modify these, it does not really matter what its implementation is.
You'd gain vertical space and a bit of performance by using list comprehensions. Also, you could treat directly array1 and array2 without any intermediary variables
That initial
[0,0]
should not be there, and that is specified ( note it says "after" every step ).Not a kata issue - but I am going to raise it as a suggestion; that initial
(0,0)
can very easily be checked for and passed.Hey you who is trying to solve this, non spoiler-ish tips:
both tips are unrelated.
Well, thank you for reminding me that basic advice, turned out that was super easy after all.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
look more carefuly at the description : it mentions the method
getNext()
to get the nextnode
. So, in order to get the next node, you can donode = node.getNext()
.the
node
object is given as an argument, and is an instance of a custom class defined somewhere else.As the challenge require you don't modify these, it does not really matter what its implementation is.
Best solution by far, as far as I can tell, the only one worthy of production : readable, no loop, shortly and well documented.
You'd gain vertical space and a bit of performance by using list comprehensions. Also, you could treat directly array1 and array2 without any intermediary variables
cheer :)