Two pointers is a common coding technique to solve some algorithm problems, not all, but many algorithm problems can be solved by using it. To be more professional on algorithm and data structure, LeetCode does help, however, the problem is that there are two many interview coding questions there, it you want to finish all of them, it might take you a very long time. Instead of going through all of them, it is better to know how to solve it and what coding techniques can be used to solve it and what is the performance (Big O Time/Space) by using the technique. In this article, we would like to discuss about 2 pointers technique. (Please be noticed that the pointer here does not only mean a pointer like in C/C++, but it also stands for the index of an array.) Keywords Sorted Array Or it is OK to Sort the Array Firstly. This is basically the usage cases for the two pointers. Use Cases Remove Duplicated From a Sorted Array Find Pair Sum Closest Pair Sum Find a triplet… Read More »Solve All Algorithm Problems – using Two Pointers technique
Solve All Algorithm Problems
Is there a way to solve all algorithm problems? No, but we can learn more coding techniques to make it easy. Like two pointers, hashtable/dictionary are all very common techniques for solving algorithm coding interview questions.