All Posts

1575 articles

dsa2 min read

Recover Binary Search Tree

Find and swap the two misplaced nodes in a BST using in-order traversal to detect the violations.

Read →
dsa2 min read

House Robber III

Maximize robbery from a tree-structured neighborhood where adjacent (parent-child) nodes cannot both be robbed.

Read →
dsa2 min read

Binary Tree Cameras

Find minimum cameras to monitor all nodes using greedy bottom-up: prefer placing cameras at parents of uncovered leaves.

Read →
dsa2 min read

Distribute Coins in Binary Tree

Count minimum moves to distribute coins evenly by tracking excess/deficit coins flowing through each edge.

Read →
Page 164 of 315