Pattern based Problem Solving
To become strong in problem solving, especially for coding interviews, online assessments (OA), and platforms like LeetCode, HackerRank and Codility, you should master the below coding patterns.
Coding Patterns
1). Binary Search Pattern – Find answer using decision function (e.g. minimize/maximize)
2). Two Pointers Pattern – Move two indices toward each other to compare or find values
3). Fast and Slow Pointers – Detect cycles or distances in linked lists/arrays
4). Sliding Window – Fixed or dynamic-sized window to track elements in a range
5). Prefix and Math Patterns – Prefix Sum – Pre-compute cumulative values
6). Difference Array – Apply range updates in O(1)
The Two pointers technique is an approach used to solve problems on arrays or lists by using two indices (pointers) that move through the data structure, usually from opposite ends or sometimes the same direction, depending on the problem.
