✅💯🔥Simple Code🚀📌|| 🔥✔️Easy to understand🎯 || 🎓🧠Beats 100%🔥|| Beginner friendly💀💯
Tuntun Mosi ko Pranam\nSolution tuntun mosi ki photo ke baad hai. Scroll Down\n\n# Code\njava []\n/*\n// Definition for a Node.\nclass Node {\n    public int va
# Tuntun Mosi ko Pranam\nSolution tuntun mosi ki photo ke baad hai. Scroll Down\n![fd9d3417-20fb-4e19-98fa-3dd39eeedf43_1723794694.932518.png](https://assets.leetcode.com/users/images/a492c0ef-bde0-4447-81e6-2ded326cd877_1724187540.6168394.png)\n# Code\n```java []\n/*\n// Definition for a Node.\nclass Node {\n    public int val;\n    public Node left;\n    public Node right;\n    public Node next;\n\n    public Node() {}\n    \n    public Node(int _val) {\n        val = _val;\n    }\n\n    public Node(int _val, Node _left, Node _right, Node _next) {\n        val = _val;\n        left = _left;\n        right = _right;\n        next = _next;\n    }\n};\n*/\n\nclass Solution {\n    public Node connect(Node root) {\n        if(root==null){\n            return root;\n        }\n        if(root.left!=null){\n            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}\n```\n![7be995b4-0cf4-4fa3-b48b-8086738ea4ba_1699897744.9062278.jpeg](https://assets.leetcode.com/users/images/fe5117c9-43b1-4ec8-8979-20c4c7f78d98_1721303757.4674635.jpeg)
['Linked List', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'C', 'Binary Tree', 'Python', 'C++', 'Java', 'JavaScript']