DSA tutorials
277 articles · page 6 of 14Hand-written tutorials, ordered as a recommended learning path.
- 101 Recent Calls Counter Solve Number of Recent Calls using a queue as a 3000ms sliding window counter. Python solution with deque, step-by-step trace, and amortized analysis.
- 102 Snakes and Ladders Solve Snakes and Ladders with BFS to find minimum dice rolls. Python solution with 1D-2D conversion, boustrophedon layout, and step-by-step trace.
- 103 132 Pattern Solve the 132 Pattern problem using a monotonic stack scanning right to left. Python solution tracking s3 candidates and s2 maximum, with detailed trace.
- 104 Sum Subarray Minimums Solve Sum of Subarray Minimums using the contribution technique with monotonic stacks. Python solution with modular arithmetic, traces, and O(n) analysis.
- 105 Zigzag Level Order Zigzag level order traversal of a binary tree using BFS and deque. Step-by-step Python solution with visual trace, complexity analysis, and interview tips.
- 106 Open the Lock Open the Lock problem solved with BFS on 4-digit state space. Python solution with deadend handling, bidirectional BFS optimization, and complexity analysis.
- 107 Word Ladder BFS Word Ladder solved with BFS and pattern matching optimization. Step-by-step Python solution for LeetCode 127 with complexity analysis and interview tips.
- 108 Max Frequency Stack Maximum Frequency Stack solved with HashMap and stack groups by frequency. Python implementation with step-by-step trace, complexity analysis, and design insights.
- 109 Tag Validator Tag Validator solved with stack-based HTML/XML tag matching and CDATA parsing. Python solution with edge cases, step-by-step trace, and complexity analysis.
- 110 Front Middle Back Queue Design Front Middle Back Queue using two balanced deques. Python solution with O(1) operations, step-by-step trace, and complexity analysis for LeetCode 1670.
- 111 Interview Patterns Comprehensive catalog of 15+ stack and queue interview patterns with when-to-use guide, Python templates, complexity analysis, and problem mapping for coding interviews.
- 112 Validate Stack Sequences Validate Stack Sequences solved by simulating push and pop operations. Python solution with step-by-step trace, edge cases, and complexity analysis for LeetCode 946.
- 113 Shortest Subarray Sum K Shortest Subarray with Sum at Least K solved with monotonic deque and prefix sums. Python solution with detailed trace, complexity analysis, and edge cases.
- 114 Real-World Applications Real-world applications of stacks and queues: undo/redo systems, browser history, call stacks, task scheduling, message queues, and BFS web crawlers with Python examples.
- 115 Next Greater Circular Next Greater Element II solved with monotonic stack and circular array double-length trick. Python solution with step-by-step trace, complexity analysis, and patterns.
- 116 BST Operations Master Binary Search Tree operations — insert, search, and all three delete cases with in-order successor. Full Python implementation with time complexity analysis.
- 117 AVL Tree Rotations Understand AVL trees — balance factors, all four rotation types (LL, RR, LR, RL), insertion with rebalancing, and complete Python implementation with height tracking.
- 118 Red-Black Trees Understand Red-Black trees — the 5 rules, insertion cases, color flips, rotations, comparison with AVL, and why Java TreeMap and Linux use them.
- 119 Lowest Common Ancestor Master LCA problems — recursive DFS for binary trees, BST property shortcut, parent pointers, and binary lifting for O(log n) queries. Full Python code.
- 120 Tree Diameter & Paths Find the diameter of a binary tree using DFS, solve maximum path sum, and understand the two-BFS approach for general trees. Full Python implementations.