I have pointer to circular doubly linked list with random values of 0 or 1.
Example: [{prev,0,next},{prev,0,next},{prev,1,next},{prev,0,next}...]
I have a single pointer to the first item of the list.
I need to find the length of the list without to create any additional pointers.
In addition, I can change the values of each node between 0 to 1 or 1 to 0.
I thought about Josephus Circle
algorithm - with no success.
My main problem is that I don't even know what end of a circle/circular list is.
If you think about that, you will understand it is not an easy question.
I don't know if I arrive to the end of the list
I don't even know what end of a circle/circular list is.) You may need to change direction, not limited to your thinking. It may help to think of Turing. $\endgroup$