Skip to content
Ultimate Algorithm

Forward Pointers

These pointers start at the same position and move to one direction. This approach is typically used in problems involving subarrays or subsequences where you need to keep track of a contiguous block of elements. For example, the problem of finding the longest substring with no repeating characters can be solved using this approach.

Forward Pointers technique is also as known as Sliding Window technique where each left pointer and right pointer proceeds in the same direction and the two pointers form windows if this makes sense haha

There are Two Sub-categories for Forward Pointers.

  1. Fixed Size
    This means the window size is fixed.

  2. Flexible Size
    This means the window size is changing according to the conditions.

ProblemTopicPlatform
Contains Duplicate IIFixed SizeLeetcode
Number of Sub Arrays of Size K and Avg Greater than or Equal to ThresholdFixed SizeLeetcode
Maximum Average Subarray IFixed SizeLeetcode
Substrings of Size Three with Distinct CharactersFixed SizeLeetcode
Minimum Size Subarray SumFlexible SizeLeetcode
Longest Substring Without Repeating CharactersFlexible SizeLeetcode
Longest Substring with At Most Two Distince CharactersFlexible SizeLeetcode
Remove Nth Node From End of ListFlexible SizeLeetcode
Longest Repeating Character ReplacementFlexible SizeLeetcode
Number Of Substrings Containing All Three CharactersFlexible SizeLeetcode