Skip to content

Instantly share code, notes, and snippets.

@Kishy-nivas
Created June 20, 2018 11:12
Show Gist options
  • Save Kishy-nivas/9ecf1c7f6eaade56737d7334ac2c41d4 to your computer and use it in GitHub Desktop.
Save Kishy-nivas/9ecf1c7f6eaade56737d7334ac2c41d4 to your computer and use it in GitHub Desktop.
string tree2str(TreeNode* root){
if(root == nullptr)
return "";
else
return root->val + "(" + tree2str(root->left) + ")" + "(" + tree2str(root->right) + ")";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment