Here is my code:
Please check why it is not passing test cases
Please find the error in my code
https://ide.codingblocks.com/s/242560
There are some minor mistakes in your code, not the process, but the order in which these steps need to be executed
so this code fixes that, u can check this out, it also has appropriate comments for better understanding
I am not able to correct the code can you pls help?
this has corrected logic for the req function
make the following changes too, print no nodes when the size of the vector p is zero
otherwise print it in sorted order and also check your tree formation
i have created a set so i don’t need to do sorting also i am checking if the multiset is empty while printing answer still its not working
this is the final code after all suggestions but its still not working
hey, as i can see, u are making consecutive calls to right and left subtree
make the call to right subtree only after the IF of left subtree
otherwise in consecutive calls for the right subtree, the variables are modified