Add sliding window function for list item comparison