If there is a path find the path Initialize empty stack and path take the starting current as discussed
Stack < Integer > stack = new Stack < > ( ) ; Vector < Integer > path = new Vector < > ( ) ; int cur = startPoint ;