Given an integer array nums and an integer k, return the number of “good” subarrays. A subarray is good if it contains at least k pairs of indices (i, j) such that i < j and nums[i] == nums[j]. A subarray is a contiguous non-empty sequence of elements within the array.
You are given a sorted array prizePositions containing positions of prizes along a line and an integer k. Your task is to select two segments of length k such that you can maximize the number of prizes collected. The two segments may overlap, and you can collect all prizes within either of the segments.
Given an integer array ’nums’ containing ’n’ integers, you are tasked with calculating the beauty of each subarray of size ‘k’. The beauty of a subarray is defined as the xth smallest negative integer in the subarray if it exists, or 0 if there are fewer than ‘x’ negative integers.
You are given a string s consisting of digits from ‘0’ to ‘9’. A string is called semi-repetitive if there is at most one pair of adjacent identical digits. Your task is to return the length of the longest semi-repetitive substring of s.
Given a list of server requests and multiple queries specifying time intervals, determine the number of servers that did not receive any requests during each query’s time interval.
You are given a 0-indexed integer array ’nums’ and an integer ’threshold’. Find the length of the longest subarray of ’nums’ that satisfies the following conditions: (1) ’nums[l]’ is even, (2) the elements alternate between even and odd, and (3) all elements in the subarray are <= threshold.