Error leetcode flatten a bst

The problem

Mt code-

https://ide.codingblocks.com/s/424816

Please correct my code and send it to me

Hey @Somasree send me the code which you are submitting on leetcode, i will check that by submitting the same on leetcode.

This is my code

Have flatten your bst by using flatten function, you can submit this flatten function on leetcode it will get accepted, just change the data type of node* to TreeNode* code is attached below


Though leetcode is using preorder build function, so output will differ, but role of flatten function is right.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.