Problem Statment


By Traversing InOrder(Left-Node-Right), We can create the linkedlist.


Here we are taking a global variable prev and creating a new node while inorder traversing and pointing to the next of previous node. prev->next = new LLNode(root->val);

Here in main function, we created a dummy variable to store the head of the linkedlist.

Time Complexity

O(n) : For In-order traversing

Space Complexity

O(n) : For creating Linklist node