left
and right
, to represent the window's bounds.right
to include new elements and update their frequency in the dictionary.n - right
to account for all subarrays starting at left
and ending at or after right
.left
forward, decrementing the frequency of the element at left
, and removing it from the dictionary if its frequency drops to zero.right
reaches the end of the array.