JAVA| 100% FAST | 0ms | EASY | RECURSION | NODE
If you find my solution helpful please upvote it, as it motivates me to post such kind of codes and help the coding community,\nif you have any queries or any i
If you find my solution helpful please upvote it, as it motivates me to post such kind of codes and help the coding community,\nif you have any queries or any improvements please feel free to comment and share your views.\n\n       class Solution {\n    public Node connect(Node root) {\n        if(root == null){\n              return root;\n        }\n        if(root.left != null) root.left.next = root.right;\n        if(root.right != null && root.next != null){\n                root.right.next = root.next.left;\n            }\n        connect(root.left);\n        connect (root.right);\n        return root;\n    }\n    }
['Recursion', 'Java']