dsa2 min read
Maximum Level Sum of a Binary Tree
Find the level with the maximum sum using BFS level-order traversal to compute each level's total.
Read →
webcoderspeed.com
1276 articles
Find the level with the maximum sum using BFS level-order traversal to compute each level's total.
Find lexicographically smallest string from any leaf to root by collecting and comparing reversed paths.
Find time for infection to spread through entire tree from a start node by converting to graph then doing BFS.
Find minimum swaps to sort each level of a binary tree using BFS and cycle-detection in permutation sorting.
Implement an in-order BST iterator with O(h) space using a stack to simulate recursive in-order traversal.