Sliding Window

Set left and right boundary of a window to control the variables

Introduction

This sort of problem requires us to set a window with left and right boundary to keep relative variables constant or compare the value of left and right index. Sometimes left and right boundary of this window keeps same direction from 0 $\rightarrow$ n-1, sometimes left and right boundary with from 0, n-1 to meet together.

Time Complexity

$O(n)$