NVIDIA interview question

depth first search of a array in a non-recursive manner without using extra memory