AlgorithmsCoding Given an array of numbers, arr, the sliding window approach is a two-pointer method to compute functions of contiguous subarrays of arr, arr[i:j]

i, j = 0, 1
while i <= j and j < n:
	window_len = (j-i) + 1
	while window_len > k or condition fails:
		i += 1
j += 1
Computational Complexity:
Time Complexity: O(n)
Space Complexity: O(1)

This technique is most applicable for querying contiguous subarrays that meet a specific condition (ex: maximum sum) or size (ex: size at most ).