LeetCode 965: Univalued Binary Tree
A clear explanation of checking whether every node in a binary tree has the same value.
80 notes
A clear explanation of checking whether every node in a binary tree has the same value.
A clear explanation of checking whether two binary trees are equivalent after swapping left and right children at any number of nodes.
A clear explanation of generating all full binary trees with n nodes using recursion and memoization.
A clear explanation of counting uni-value subtrees using post-order DFS.
A clear explanation of counting strobogrammatic numbers in a string range using recursive generation and range filtering.
A clear explanation of generating all strobogrammatic numbers of length n using recursion from the inside out.
A clear explanation of inserting a value into a maximum binary tree by following the right spine.
A clear explanation of finding the smallest subtree that contains all deepest nodes using bottom-up DFS.
A postorder DFS solution for removing every binary tree subtree that does not contain a 1.
A clear explanation of generating all strings formed by independently changing each letter to lowercase or uppercase.
A clear explanation of finding the kth symbol in the grammar sequence using recursion and the parent-child relationship.
A clear explanation of splitting a binary search tree into two BSTs using recursion and pointer rewiring.
A clear explanation of evaluating arithmetic expressions with parentheses, precedence, and integer division.
A clear explanation of simplifying algebraic expressions by parsing, substituting variables, and combining polynomial terms.
A clear explanation of making a special binary string lexicographically largest using recursive decomposition and sorting.
A clear explanation of inserting a value into a binary search tree using recursive and iterative traversal.
Evaluate a Lisp-like expression with integers, variables, let bindings, addition, multiplication, and lexical scope.
A clear explanation of trimming a BST so that all remaining node values lie inside a given inclusive range.
A clear explanation of formatting a binary tree into a 2D string matrix using tree height and recursive placement.
A clear explanation of constructing a maximum binary tree recursively using divide and conquer.
A design solution for a small Excel-like spreadsheet that supports set, get, and dynamic sum formulas.
A recursive tree traversal guide for merging two binary trees node by node.
A recursive guide for converting a binary tree into a preorder parenthesized string while preserving the one-to-one mapping between the tree and the string.
A clear explanation of generating all possible results from different parenthesizations using divide and conquer recursion.
A clear explanation of finding the lowest common ancestor in a normal binary tree using recursive depth-first search.
A clear explanation of checking whether a singly linked list is a palindrome using fast and slow pointers plus in-place reversal.
A clear explanation of inverting a binary tree using recursive depth-first traversal.
A clear explanation of Pow(x, n) using binary exponentiation to compute powers in logarithmic time.
Find the longest path in a binary tree where every node on the path has the same value using depth-first search.
A clear DFS solution for returning the postorder traversal of an N-ary tree.
A clear DFS solution for returning the preorder traversal of an N-ary tree.
A clear explanation of Subtree of Another Tree using recursive tree matching and DFS.
A clear explanation of maximizing remove-box scores using interval dynamic programming with memoization.
A clear explanation of building the final tournament bracket by repeatedly pairing strongest and weakest teams.
A clear explanation of finding the longest path between any two nodes in a binary tree using DFS height computation.
A clear explanation of parsing a parenthesized string recursively to construct a binary tree.
A clear explanation of computing Fibonacci numbers using dynamic programming and iterative state transitions.
A clear explanation of merging two quad-trees using recursive logical OR operations.
A clear explanation of predicting whether Player 1 can win using minimax dynamic programming over score difference.
Delete a node from a binary search tree while preserving the BST property using recursive search and inorder successor replacement.
Flatten a multilevel doubly linked list in-place using depth-first traversal and pointer splicing.
Serialize an N-ary tree into a string and reconstruct the same tree using preorder traversal with child counts.
Build a quad tree from a binary square grid using recursive divide and conquer.
A clear explanation of the Sum of Left Leaves problem using depth-first traversal of a binary tree.
A clear explanation of reducing an integer to 1 with the fewest operations using greedy bit decisions.
A clear explanation of decoding nested repeat expressions using a stack.
A clear explanation of finding the last remaining number after alternating left-to-right and right-to-left eliminations.
A clear explanation of computing large modular exponentiation using fast power, modular arithmetic, and digit decomposition.
A clear explanation of Nested List Weight Sum using depth-first search over a nested structure.
A clear explanation of the Power of Three problem using repeated division and integer arithmetic.
A backtracking solution for inserting operators into a numeric string so the expression evaluates to a target value.
A clear explanation of the Integer to English Words problem using three-digit chunks and scale words.
A clear explanation of counting nodes in a complete binary tree faster than visiting every node.
A clear explanation of reversing a singly linked list using iterative and recursive approaches.
A detailed guide to solving Validate Binary Search Tree with recursive lower and upper bounds.
A detailed guide to solving Unique Binary Search Trees II with recursive tree generation over value ranges.
A detailed guide to solving Binary Tree Inorder Traversal with recursion and an iterative stack.
A detailed guide to solving Scramble String with recursive dynamic programming and memoization.
A detailed guide to solving Combinations with backtracking and pruning.
A clear explanation of flipping a binary tree upside down by rewiring pointers from the left spine.
Compute the sum of all numbers formed by root-to-leaf paths using depth-first search and decimal accumulation.
A clear explanation of flattening a binary tree into a linked list in preorder traversal order using recursive depth-first search.
A clear explanation of finding all root-to-leaf paths whose values add up to a target sum using depth-first search and backtracking.
A clear explanation of checking whether a binary tree has a root-to-leaf path whose values add up to a target sum.
A clear explanation of checking whether a binary tree is height-balanced using bottom-up depth-first search.
A clear explanation of building a height-balanced binary search tree from a sorted array using divide and conquer.
A clear explanation of rebuilding a binary tree from inorder and postorder traversals using recursion and an index map.
A clear explanation of rebuilding a binary tree from preorder and inorder traversals using recursion and an index map.
A clear explanation of finding the maximum depth of a binary tree using recursive depth-first search.
A clear explanation of checking whether a binary tree is symmetric using mirror recursion.
A clear guide to finding the kth permutation sequence using factorial blocks instead of generating all permutations.
A detailed explanation of reversing linked-list nodes in groups of k using pointer manipulation and constant extra space.
A detailed explanation of swapping every two adjacent nodes in a linked list using pointer manipulation.
A detailed explanation of merging two sorted linked lists using a dummy node and pointer splicing.
A detailed explanation of matching a full string against a simplified regular expression with dot and star using dynamic programming.
Linear search expressed recursively by reducing the problem size one element at a time.
Binary search implemented using recursion over a shrinking interval.
Using base cases and step rules to prove statements about objects built recursively.
Defining objects step by step and proving properties by following the same construction.
Recursive algorithms replace loop structure with self-reference.