I am getting correct output But not passing testcase.
I am getting correct output But not passing testcase
hi @Mihir163
mistakes
- you have to print in inorder traversal
- there is mistake in ranges
preorderMOdified(root1->right,k2,k2);
this should be preorderMOdified(root1->right,k1,k2); - Print according to the question as directed
cout<<"# Preorder : ";
preorder(root);
and then
cout<<"# Nodes within range are : ";
preorderMOdified(root,k1,k2);
i have corrected all mistake you can see in modified code
modified code
if your doubt is resolved Please mark it as resolved