dsa2 min read
Check Completeness of a Binary Tree
Verify a binary tree is complete using BFS: once a null child is seen, no more non-null nodes should follow.
Read →
1575 articles
Verify a binary tree is complete using BFS: once a null child is seen, no more non-null nodes should follow.
Find and swap the two misplaced nodes in a BST using in-order traversal to detect the violations.
Maximize robbery from a tree-structured neighborhood where adjacent (parent-child) nodes cannot both be robbed.
Find minimum cameras to monitor all nodes using greedy bottom-up: prefer placing cameras at parents of uncovered leaves.
Count minimum moves to distribute coins evenly by tracking excess/deficit coins flowing through each edge.