~/lc-grind
#295 - Find Median from Data Stream
Aug 1, 2025Design a data structure that efficiently maintains the median of a dynamic data stream using two heaps for optimal O(log n) insertions and O(1) median retrieval.
#347 - Top K Frequent Elements
Jul 31, 2025Master efficient techniques like heap, bucket sort, or quickselect to solve this classic problem of finding the top K frequent elements in an array—optimal solutions go beyond basic sorting!
#212 - Word Search II
Jul 30, 2025Solve the **Word Search II** problem by finding all words from a given list that can be constructed on an m×n board using adjacent letters, employing backtracking and a Trie for optimal efficiency—perfect for mastering matrix traversal and advanced search techniques!
#208 - Implement Trie (Prefix Tree)
Jul 29, 2025Learn how to implement a **Trie (Prefix Tree)**—a powerful data structure for efficient string storage and retrieval—with methods to `insert`, `search`, and check for prefixes, perfect for autocomplete and spellchecker systems.
#235 - Lowest Common Ancestor of a Binary Search Tree
Jul 28, 2025Learn how to efficiently find the lowest common ancestor of two nodes in a binary search tree by leveraging BST properties with a clean recursive or iterative approach.
#230 - Kth Smallest Element in a BST
Jul 25, 2025Find the kth smallest element in a Binary Search Tree (BST) efficiently using in-order traversal or iterative DFS, with a follow-up on optimizing for dynamic BSTs.
#98 - Validate Binary Search Tree
Jul 24, 2025Learn how to validate a binary search tree (BST) by ensuring every node follows the BST property—left children are smaller and right children are larger—using efficient depth-first traversal.
#105 - Construct Binary Tree from Preorder and Inorder Traversal
Jul 23, 2025Learn how to reconstruct a binary tree from its preorder and inorder traversal arrays using divide-and-conquer and hash tables for efficient lookups.
#572 - Subtree of Another Tree
Jul 22, 2025Check if a binary tree contains another binary tree as a subtree, matching both structure and node values, using DFS or hashing techniques.
#297 - Serialize and Deserialize Binary Tree
Jul 21, 2025Master binary tree serialization and deserialization by designing efficient algorithms to convert a tree into a string and reconstruct it back, tackling this Hard problem with creative DFS/BFS or custom parsing approaches.