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 ; Console . Write ( " ( " ) ; for ( int i = 0 ; i < path . Count ; i ++ ) { Console . Write ( path [ i ] + " , ▁ " ) ; } Console . Write ( root . data + " ) , ▁ " ) ; } return ; }