Sliding Window

The sliding window technique can be applied to Strings and Arrays. It helps to solve the problem with O(n) time complexity otherwise will take O(n^2) or O(n^3).

The space complexity could be O(n) .There would be one more data structure generally to hold the data in a given window.

There are two types of sliding windows:

  • Fixed-size sliding window

  • Variable Size sliding window

References:

Last updated

Was this helpful?