Longest Distinct Stretch — Solution & Editorial
Remember each value's last position; when the current value reappears inside the window, jump the left edge past its previous occurrence.
Complexity: O(N)
Remember each value's last position; when the current value reappears inside the window, jump the left edge past its previous occurrence.
Complexity: O(N)