</>OfferRetriever
DashboardDiscuss
NEW

Spring Hire Sale

Limited Time Deal: Unlock all premium questions for over 30% off

$10.42$7.08

08

:

04

:

55

:

17

Get this deal
Back to Dashboard

Best Window For Target Count

Medium

A log analysis tool searches for the most frequent occurrence of a specific error code within a fixed-size window of log entries. Given an integer array codes, an integer targetIndex (the position of the error code to search for), and an integer windowSize, find the starting index of a contiguous subarray of length windowSize that contains the maximum number of occurrences of codes[targetIndex]. On ties, return the smallest starting index.

Function: bestWindowForTargetCount(codes: list<int>, targetIndex: int, windowSize: int) -> int ...