dsa1 min read
Path Sum III — Prefix Sum HashMap on Tree
Count paths in a binary tree summing to target (not necessarily root-to-leaf) using a prefix sum frequency map.
Read →
1575 articles
Count paths in a binary tree summing to target (not necessarily root-to-leaf) using a prefix sum frequency map.
Find and delete a node from a BST while maintaining BST properties using in-order successor.
Flatten a binary tree to a linked list in-place using pre-order traversal order.
Connect each node to its next right node using BFS level order or O(1) space pointer manipulation.
Find all nodes at distance K from a target node by building parent pointers then doing BFS.