top of page


Two Pointer 1
Overview This is the technique which uses 2 pointers, the first one is located at beginning of the array, the second one is located at the end of the array. 2 pointer will move toward together to resolve the problem Example: Given a sorted array [1, 3, 8, 9, 10], check if exist the pair that sum is given target (12). For the bruth force, we can use 2 pointer i and j which j = i+1 then each element arr[i] check any arr[j] which sum to targe. By this way we took 2 for loop so

Hunnina
2 hours ago1 min read
bottom of page