We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
from the list, [2, 3] means 1's left child is 2 and right child is 3, [4, -1] means 2's left child is 4, right child is null, [5, -1] means 3's left child is 5, right child is null, etc. leaf is represented as [-1, -1]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Swap Nodes
You are viewing a single comment's thread. Return to all comments →
from the list, [2, 3] means 1's left child is 2 and right child is 3, [4, -1] means 2's left child is 4, right child is null, [5, -1] means 3's left child is 5, right child is null, etc. leaf is represented as [-1, -1]