Good morning! Here's your coding interview problem for today.
This problem was asked by Yext.
Two nodes in a binary tree can be called cousins if they are on the same level of the tree but have different parents. For example, in the following diagram 4 and 6 are cousins.
Given a binary tree and a particular node, find all cousins of that node.
Good morning! Here's your coding interview problem for today.
This problem was asked by Yext.
Two nodes in a binary tree can be called cousins if they are on the same level of the tree but have different parents. For example, in the following diagram
4and6are cousins.Given a binary tree and a particular node, find all cousins of that node.