Identifying the fixed sized sliding window pattern
The fixed-size sliding window technique can only be applied to some specific problems. These are generally easy or medium problems where we must remember some or all occurrences of data items in all windows a fixed size. Once we map all data items in a window to some values, we use the hash map to solve the problem partially or completely.
If the problem statement or its solution follows the generic template below, it can be solved by applying the fixed-sized sliding window technique.
Template:
Given an iterable sequence of data, for all windows of size
k, map all the data items in the window to some values and use them to solve the problem.Liking the course? Check our discounted plans to continue learning.