Tag: #patterns
Heap patterns for coding interviews: how to recognize and solve heap problems
Heap problems often look different, but most of them are built around a small set of recurring patterns. Top K Elements, K-way Merge, Two Heaps, and Repeated Min/Max cover the most common ways Heap and Priority Queue are used in LeetCode and coding interview problems.
Read moreFast & Slow pointers pattern: Tortoise and Hare technique for coding interview
The Fast & Slow pointers pattern uses two pointers moving at different speeds to detect cycles, find middle elements, and solve Linked List and sequence problems efficiently.
Read moreBinary Search patterns
The Binary Search pattern can be divided into four main variations. Finding a target in a sorted array is Classic Binary Search. The other three - Boundary Search, Binary Search on Answer, and Modified Sorted Data - represent more advanced ways of applying the Binary Search pattern.
Read moreSliding Window pattern: types, examples, and LeetCode problems
The Sliding Window pattern is one of the most common techniques for solving array and string problems involving contiguous ranges. This section covers fixed-size and variable-size windows, common variations, recognition rules, and practical examples from LeetCode.
Read moreTwo Pointers pattern in detail: how to recognize and use it
The Two Pointers pattern one of the most common and famous patterns. It uses two indices or pointers to process data efficiently, with different variations for arrays, strings, and linked lists.
Read more