Problem-solving patterns, also known as problem-solving techniques or strategies, are systematic approaches that can help you tackle coding and algorithmic challenges more effectively. Here are some problem-solving patterns commonly used in coding:

##### (1). Two Pointers

Use two pointers that traverse the data structure from different directions to solve problems efficiently. This is common in problems involving searching or checking for certain conditions in arrays or linked lists.

##### (2). Sliding Window

Efficiently process arrays or lists by maintaining a “window” of elements. This pattern is particularly useful for problems involving substring or subarray manipulation.

#### (3). Islands(Matrix Traversal)

This pattern is used to count or process islands in a matrix/grid. Data structuresinvolved in this pattern are Matrix (2D array and Queue).

#### (4). Fast & Slow Pointers

It involves using two pointers that move through a sequence or data structure at different speeds (hence the names “fast” and “slow”) to solve a variety of problems efficiently.

#### (5). Merge Intervals

Merging intervals is a common problem in computer science and is often encountered in scenarios where you have a list of intervals and you need to combine overlapping intervals into a consolidated form. The goal is to simplify the representation of intervals by merging those that overlap. This technique is used to deal with overlapping intervals.

Data structures used in this technique are Array and Heap.

#### (6). Breadth-First Search(BFS)

This technique is used to solve problems involving traversing trees or graphs on a BFS manner. Breadth-First Search (BFS) is a graph traversal algorithm used to explore and analyze the structure of a graph or tree in a systematic way. It starts at a specified node (often called the “root” in a tree or the “source” in a graph) and explores all of its neighbors at the current depth before moving on to nodes at the next depth level. BFS is commonly used to find the shortest path between two nodes in an unweighted graph and can also be used for tasks like finding connected components in a graph.

#### (7). Depth-First Search(DFS)

This technique is used to solve problems involving traversing trees or graphs on a DFS manner.Depth-First Search (DFS) is a graph traversal algorithm used to explore and analyze the structure of a graph or tree. Unlike Breadth-First Search (BFS), which explores all neighbors at the current level before moving to the next level, DFS explores as far as possible along each branch before backtracking. DFS can be implemented using either recursion or an explicit stack data structure.

#### (8). Two Heaps

In many problems, we are given a set of elements that can be divided into two parts. Data structures involved are array and heap.

#### (9). Subsets

This technique is used when dealing with permutations or combinations of a set of elements. Data structures involved are array, queue and string.

#### (10). Binary Search

This technique is used when either data is sorted or data can be divided into two parts such that binary search can be applied on both the partitions.