You are viewing a single comment's thread. Return to all comments →
SELECT N, CASE WHEN P IS NULL THEN 'Root' WHEN N IN (SELECT P FROM BST) THEN 'Inner' ELSE 'Leaf' END AS BST_TYPES FROM BST ORDER BY N,BST_TYPES
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Binary Tree Nodes
You are viewing a single comment's thread. Return to all comments →
SELECT N, CASE WHEN P IS NULL THEN 'Root' WHEN N IN (SELECT P FROM BST) THEN 'Inner' ELSE 'Leaf' END AS BST_TYPES FROM BST ORDER BY N,BST_TYPES