Given timestamps[] of packet arrivals and labels[], a target_label and window_size, return the count of packets with target_label in each sliding window of window_size seconds, moving one second at a time.
Asked in the tech screen stage. Treat each window as half-open, [start, start + window_size). Produce one count for every integer start from the minimum timestamp through the maximum timestamp, inclusive.
Implement count_target_packets(timestamps, labels, target_label, window_size). timestamps and labels are equally sized lists, and labels[i] belongs to the packet arriving at timestamps[i]. Return a list of integers. Timestamps are sorted in nondecreasing order, and window_size is positive.
def count_target_packets(timestamps, labels, target_label, window_size):