Using just a stack of pair


#1

Instead of having an unordered map just use another value in the stack to denote if that node has been visited for the second time.