LeetCode 967: Numbers With Same Consecutive Differences
A clear explanation of generating all n-digit numbers whose adjacent digits differ by k.
31 notes
A clear explanation of generating all n-digit numbers whose adjacent digits differ by k.
A clear explanation of checking whether a binary tree is complete using level-order traversal.
A clear explanation of the Shortest Path Visiting All Nodes problem using multi-source BFS and bitmask state compression.
A clear explanation of the Keys and Rooms problem using graph traversal from room 0.
A clear explanation of the Making A Large Island problem using connected component labeling and island size lookup.
A clear explanation of minimizing malware spread by analyzing connected components with Union Find.
A clear explanation of maintaining a complete binary tree inserter using level-order indexing.
A clear explanation of Cat and Mouse using game states, reverse BFS, and topological propagation.
A clear explanation of Snakes and Ladders using breadth-first search over board squares.
A clear explanation of finding the minimum time for all oranges to rot using multi-source BFS.
A clear explanation of checking whether two binary tree nodes are cousins using BFS with parent tracking.
A clear explanation of vertical tree traversal using coordinates, DFS, sorting, and column grouping.
A clear explanation of solving Shortest Bridge using DFS to mark one island and BFS to expand toward the other island.
A clear explanation of solving Minimize Malware Spread II by removing each infected node and simulating the final malware spread.
Simulate virus containment by repeatedly quarantining the most dangerous infected region and spreading the remaining regions.
Find the nearest leaf to a target node by converting the tree into an undirected graph and running breadth-first search.
Recolor the connected component containing the starting pixel using depth-first search.
A clear explanation of cutting trees in increasing height order using repeated BFS on a grid.
A clear explanation of computing the maximum width of a binary tree using level-order traversal and complete-tree indices.
A breadth-first search solution for computing the average value of nodes at each level of a binary tree.
A clear explanation of Maximum Depth of N-ary Tree using recursive depth-first search.
A clear explanation of counting connected components in an undirected graph represented by an adjacency matrix.
A clear explanation of computing the distance to the nearest zero in a binary matrix using multi-source BFS.
A clear explanation of updating a Minesweeper board using DFS flood fill and adjacent mine counting.
A clear explanation of solving the Water and Jug Problem using Bézout's identity and greatest common divisor.
A clear explanation of Nested List Weight Sum using depth-first search over a nested structure.
A multi-source BFS solution for filling each empty room with its shortest distance to the nearest gate.
A dynamic programming solution for finding the least number of perfect square numbers that sum to n.
A detailed guide to solving Same Tree with recursive DFS and structural comparison.
A clear explanation of counting connected groups of land cells in a grid using DFS or BFS.
A clear explanation of returning the visible nodes from the right side of a binary tree using level-order traversal.