If the leaf node is encountered , then the path is printed if the size of the path vector is greater than 0
if ( root -> left == NULL && root -> right == NULL ) { if ( flag == 1 ) { ans = 1 ; cout << " ( " ; for ( int i = 0 ; i < path . size ( ) ; i ++ ) { cout << path [ i ] << " , ▁ " ; } cout << root -> data << " ) , ▁ " ; } return ; }