š§®Algorithm
9 posts
Show
- Breaking Down the Graph Family: Course Schedule to Clone Graph to Word Ladderā Kahn's algorithm for detecting cycles, a dictionary that doubles as both a visited-check and a lookup table, and a word game that turns out to be BFS in disguise ā all reusing the same snapshot-queue engine from grid BFS.#algorithm#graph#bfs#dfs#leetcode#python12 min read
- Breaking Down the Tree Family: Level Order to Validate BST to LCAā Grid BFS's snapshot trick reused on trees, four ways to validate a BST, and a lowest-common-ancestor algorithm that turns out to be the same trick as linked list intersection wearing a different hat.#algorithm#tree#bst#bfs#dfs#leetcode#python9 min read
- Breaking Down Grid BFSā Four problems, one skeleton ā Number of Islands, Max Area, Rotting Oranges, and Flood Fill. Learn the skeleton once, then track only what changes.#algorithm#bfs#graph#leetcode#python8 min read
- Breaking Down the Interval Family: Merge Intervals to Meeting Rooms IIIā One family, one first move ā sort by start. Then it branches: merge into blobs, count with a sweep or a bucket array, keep room identities with a heap, add passenger weights, or juggle two heaps when a delayed meeting needs a specific room. The question that splits every follow-up: do you need WHO, or just HOW MANY?#algorithm#intervals#heap#sweep-line#leetcode#python13 min read
- Breaking Down the Stack Family: Valid Parentheses to LRU Cacheā Counters vs stacks, why Min Remove stores indexes, Min Stack three ways, and the design story behind LRU Cache ā a hashmap that answers 'where' married to a linked list that answers 'who's oldest'.#algorithm#stack#design#leetcode#python10 min read
- Breaking Down Number of Islandsā LeetCode #200 ā the grid traversal pattern behind so many interview problems, and why I picked BFS over recursive DFS.#algorithm#bfs#dfs#graph#leetcode4 min read
- Breaking Down Stock Trading DPā From one trade to multiple trades to cooldown ā same pattern, different constraints#leetcode#algorithm#dynamic-programming#greedy4 min read
- Breaking Down Two Sumā LeetCode #1 Two Sum ā there's more to it than just HashMap#algorithm#two-pointer#hashmap#leetcode5 min read
- Breaking Down Sliding Windowā A technique that turns O(n²) subarray problems into O(n) by maintaining two pointers that define a moving window.#today-i-learned#algorithm#sliding-window#python5 min read