Populating Next Right Pointers in Each Node II Leetcode most efficient solution. Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
Initially, all next pointers are set to NULL.
This video explains the most efficient solution to this problem with the time complexity as O(N) and space complexity as O(1)

0 Comments